Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by defterniko · Aug 10, 2013 at 05:32 PM · resetincreasewavesround

Rounds reset

At the end of each round in my game, I reset all the spawn point and increase the rounds count by 1 and the total rounds by 1. At round 5 I load a boss, once the boss is dead I reset the spawn point, increase the total rounds by 1 and reset the rounds count 1.

On the rounds count from 1 - 4 it works perfectly, after the boss round though, it seems to just keep increasing and I'm struggling to figure out why.

Here's the code I have in the update function:

 void Update () 
     {    
         //check all spawns are in active            
         for(int i = 0; i < 8; i++)
         {
             if(redSpawnPoints[i].GetComponent<redEnemySpawn>().isComplete == true)            
             {
                 roundComplete = true;
                 break;
             }
             else
             {
                 roundComplete = false;
                 break;
             }
             if(greenSpawnPoints[i].GetComponent<greenEnemySpawn>().isComplete == true)            
             {
                 roundComplete = true;
                 break;
             }
             else
             {
                 roundComplete = false;
                 break;
             }
         }
         if(redBossDEAD == true)
         {
             roundComplete = true;
         }
         if(aliveCount == 0)
         {            
             if(roundComplete == true)
             {
                 roundComplete = false;            
                 print ("ROUND COMPLETE!!!!!!!!!!!");                
                 
                 if(roundsCount < 5)
                 {
                     roundsCount +=1;
                     print ("rounds count = " + roundsCount);
                     reset ();
                     
                 }
                 else if(roundsCount == 5)
                 {
                         //check to see if red boss level is complete
                         if(redBossDEAD == false)// && redBossDEAD != true)
                         {
                             //if not make the spawn active
                             redBossSpawn.GetComponent<redBossSpawn>().isActive = true;
                             for(int i = 0; i < 8; i++)
                             {
                                 redSpawnPoints[i].GetComponent<redEnemySpawn>().isComplete = true;
                             }
                         }                
                         else
                         {            
                             roundsCount = 1;
                             print ("rounds count = " + roundsCount);
                             reset ();
                         }
                 }                
                 
                 totalRounds +=1;
                 print ("total rounds = " + totalRounds);            
             }
         }
         
     }        


And here the code for the reset() function:

 void reset()
     {
         for(int i = 0; i < redSpawnPoints.Length; i++)
         {
             redSpawnPoints[i].GetComponent<redEnemySpawn>().count = 0;
             redSpawnPoints[i].GetComponent<redEnemySpawn>().isComplete = false;            
         }
         if(totalRounds >5)
         {
             for(int j = 0; j < greenSpawnPoints.Length; j++)
             {
                 greenSpawnPoints[j].GetComponent<greenEnemySpawn>().count = 0;
                 greenSpawnPoints[j].GetComponent<greenEnemySpawn>().isComplete = false;            
             }
         }
     }

Like I said, I'm struggling to figure out what is causing this, I've even tested it without the boss even being there and just reset as normal but for some reason it still keeps increasing. Any ideas?

Comment
Add comment · Show 13
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Joyrider · Aug 10, 2013 at 05:38 PM 0
Share

so your roundsCount keeps going on? 5 - 6 - 7 - ..?

avatar image noooodley · Aug 10, 2013 at 05:38 PM 0
Share

By "seems to keep increasing", do you mean the round count goes 1,2,3,4,5,6,7...?

avatar image defterniko · Aug 10, 2013 at 05:40 PM 0
Share

yes to both, it does stop though at around 500+ on the Total rounds, and carries on the game.

avatar image Joyrider · Aug 10, 2013 at 05:43 PM 0
Share

do you use roundsCount anywhere alse in your code?

avatar image defterniko · Aug 10, 2013 at 05:45 PM 0
Share

no not at all

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Image processing: reseting image problems 1 Answer

Intensifying rate over time... 1 Answer

reset level on collision 3 Answers

Rounds increasing exteremely fast 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges