Esempio n. 1
0
        /// <summary>
        /// Spawn the enemies
        /// </summary>
        static void Play()
        {
            // Spawns the enmy when it is time
            for (int i = 0; i < Wave.Count; i++)
            {
                if (Wave[i].IsTime())
                {
                    if (Wave[i].Spawn())
                    {
                        curEnemies.Add(new AI(-90 * (float)(MathF.PI / 180.0f), spawnBounds.PointInBounds(), 3, 1000, 300, player));
                    }
                }
                if (Wave[i].IsDone()) // Once all enemies in the subwave have spawned
                {
                    Wave.Remove(Wave[i]);
                }
            }

            // Once all waves have spawned all their enemies
            if (Wave.Count == 0)
            {
                Console.WriteLine("spawning finished"); //Signal the end of the wave spawning
                curStage = SpawnStage.WAITFORWAVEEND;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Wait for the next wave
 /// </summary>
 static void Wait()
 {
     if (waitTimer.Check() && currentNumberOfEnemies <= totalEnemiesForWave / 2)
     {
         curStage = SpawnStage.PREPAREWAVE;
     }
 }
Esempio n. 3
0
    public void UpdateMessageAction(Message.Action action)
    {
        message.action = action;
        stage          = SpawnStage.Dir;

        stagedBird.SetActionSelectionChoice(action);
        UI.SetSpawnStage(stage);
    }
Esempio n. 4
0
    public void ResetSelf()
    {
        message = new Message();
        UI.Reset();

        stagedBird = Instantiate(birdPrefab).GetComponent <FlyingBirdUI>();
        stagedBird.GetComponentInChildren <SpriteRenderer>().color = Colors.lightColors[playerIndex];
        stagedBird.transform.position = spawnPoint.position;

        int initialStage = 0;

        stage = (SpawnStage)initialStage;
    }
Esempio n. 5
0
    public void SetSpawnStage(SpawnStage stage)
    {
        switch (stage)
        {
        case SpawnStage.Action:
            wasdDir.SetActive(false);
            wasdAction.SetActive(true);
            break;

        case SpawnStage.Dir:
            wasdDir.SetActive(true);
            wasdAction.SetActive(false);
            break;
        }
    }
Esempio n. 6
0
        /// <summary>
        /// Prepare the next wave for spawning
        /// </summary>
        static void StartSpawn()
        {
            waveNum++;
            totalEnemiesForWave = currentNumberOfEnemies;

            // Adding enemies to subwaves
            Wave.Add(new SubWave(waveNum, 0f, 0.5f, 6 + (int)(2.0f * (waveNum - 1))));
            if (waveNum > 6)
            {
                for (int i = 0; i < waveNum / 6; i++)
                {
                    Wave.Add(new SubWave(waveNum, (i * 3) + 2, 0.75f, 1 + (int)(waveNum / 3)));
                }
            }
            if (waveNum > 12)
            {
                for (int i = 0; i < (waveNum / 6) - 1; i++)
                {
                    Wave.Add(new SubWave(waveNum, (i * 3) + 3, 1f, 1 + (int)(waveNum / 3)));
                }
            }
            if (waveNum > 24)
            {
                for (int i = 0; i < (waveNum / 6) - 2; i++)
                {
                    Wave.Add(new SubWave(waveNum, (i * 3) + 4, 1f, 1 + (int)(waveNum / 3)));
                }
            }

            // Preping for end of wave
            foreach (SubWave sw in Wave)
            {
                sw.ResetTimestamp(); //We need this so that the timestamps are correct
                totalEnemiesForWave += sw.amount;
            }

            currentNumberOfEnemies = totalEnemiesForWave;
            curStage = SpawnStage.SPAWNENEMIES;
        }