Beispiel #1
0
        private void GameInit()
        {
            score = 0;
            destinationsAmount = 8;
            currentLevel       = 1;
            ingameUi.UpdateScore(score);
            lives = 10;
            ingameUi.UpdateLives(lives);
            currentParams = startingParams;


            // Clean up so we can rerandomize properties for next game
            currentlyUsedProperties.Clear();
            while (currentlyUsedProperties.Count < 4)
            {
                string propertyToAdd = globalDestinationProperties[Random.Range(0, globalDestinationProperties.Count)];
                currentlyUsedProperties.Add(propertyToAdd);
            }
            List <string> spawnerDestinations = new List <string>();
            int           i = 0;

            foreach (string str in currentlyUsedProperties)
            {
                Destinations[i].ClearDestinations();
                Destinations[i].AddDestionations(str);
                spawnerDestinations.Add(str);
                i++;
            }
            spawner.SetNewSpawnParams(spawnerDestinations);
        }
Beispiel #2
0
        public void OnSpawningFinished()
        {
            currentParams += paramsPerLevel;
            currentLevel++;
            if (currentLevel % 5 == 0)
            {
                if (destinationsAmount <= globalDestinationProperties.Count)
                {
                    AddDestinations(destinationsAmount);
                }

                destinationsAmount += 4;
            }
            Invoke("NextRound", 4.0f);
        }
Beispiel #3
0
        public static NpcParams operator+(NpcParams a, NpcParams b)
        {
            NpcParams npcParams = new NpcParams();

            npcParams.npcAmount    = a.npcAmount + b.npcAmount;
            npcParams.minTimeDelay = a.minTimeDelay + b.minTimeDelay;
            if (npcParams.minTimeDelay < 0.1)
            {
                npcParams.minTimeDelay = 0.1f;
            }
            if (npcParams.maxTimeDelay < 0.2)
            {
                npcParams.maxTimeDelay = 0.2f;
            }
            npcParams.maxTimeDelay = a.maxTimeDelay + b.maxTimeDelay;
            return(npcParams);
        }