Пример #1
0
    void Start()
    {
        rb = GetComponent <Rigidbody> ();

        targetColor.color = new Color(0, 0, 0, 0);
        targetPoint       = GameObject.Find("Player").GetComponent <Transform>();
        gameController    = GameObject.Find("GameControl");
        spawnWave         = gameController.GetComponent <SpawnWave>();

        //if (shipID == 0 || shipID == 1 || shipID == 2)
        //{
        //    targetPoint = GameObject.Find("Player").GetComponent<Transform>();
        //    SetColor(0);

        //}
        //else if (shipID == 106)
        //{
        //    targetColor.color = new Color(0, 0, 0, 0);
        //    targetPoint = GameObject.Find("Player").GetComponent<Transform>();
        //    gameController = GameObject.Find("GameControl");
        //    spawnWave = gameController.GetComponent<SpawnWave>();
        //}
        //        else if (shipID == 104)
        //        {
        //            StartCoroutine(SimulateProjectile());
        //
        //        }


        //        SetInitialPosition();
    }
Пример #2
0
 public void NotifyWaveStarting(SpawnWave wave)
 {
     if (OnNotifyWaveStarting != null)
     {
         OnNotifyWaveStarting(wave);
     }
 }
Пример #3
0
    void StartNextWave()
    {
        if (spawnWaves.Count == 0)
        {
            //finished = true;


            if (spawnedEnemies.Count <= 0)
            {
                GameManager.Instance.NotifyLevelFinished(true);
            }
        }
        else
        {
            SpawnWave wave = spawnWaves[0];
            waveCount += 1;
            Spawn(wave);

            spawnWaves.RemoveAt(0);
            _CurrentWaveTimeout = WaveTime;

            GameManager.Instance.NotifyWaveChanged(waveCount, waveTotal);
            GameManager.Instance.NotifyWaveStarting(wave);
        }
    }
Пример #4
0
 private IEnumerator SpawnNextWave()
 {
     _nextWaveIndex++;
     if (_nextWaveIndex > _waves.Length - 1)
     {
         while (_coffeeMakersAlive != 0)
         {
             yield return(null);
         }
         _gameController.EndGame(win: true);
     }
     else
     {
         if (_nextWaveIndex != 0)
         {
             while (_coffeeMakersAlive != 0)
             {
                 yield return(null);
             }
             yield return(ShowShop());
         }
         SpawnWave nextWave = _waves[_nextWaveIndex];
         yield return(SpawnNextWave(nextWave));
     }
 }
    private IEnumerator SpawnFirstStates()
    {
        if (_firstStates.Length == 0)
        {
            Debug.LogError("Need a first wave.");
        }

        for (int i = 0; i < _firstStates.Length; i++)
        {
            if (i > 0)
            {
                yield return(new WaitForSeconds(_firstStates[i - 1].TotalDuration));
            }
            StartCoroutine(ExecuteSpawnState(_firstStates[i]));
        }

        SpawnWave previousWave = _firstStates[_firstStates.Length - 1];

        if (_firstStates.Length > 0)
        {
            yield return(new WaitForSeconds(previousWave.TotalDuration));
        }

        StartCoroutine(SpawnLoop(previousWave));
    }
Пример #6
0
 private void Awake()
 {
     inputParser = FindObjectOfType <InputParser>();
     spawnWave   = FindObjectOfType <SpawnWave>();
     ConfigCanvas();
     Invoke("SpawnNewWords", 2);
 }
Пример #7
0
 void Spawn(SpawnWave spawnWave)
 {
     for (int spawnPoint = 0; spawnPoint < spawnWave.SpawnPoints.Count; spawnPoint++)
     {
         var spawn = spawnWave.SpawnPoints[spawnPoint];
         for (int i = 0; i < spawn.slimes; i++)
         {
             GameManager.Instance.RequestEnemySpawn(SpawnableObjects.Instance.SlimePool, spawnPoint);
         }
         for (int i = 0; i < spawn.slimes_with_gun; i++)
         {
             GameManager.Instance.RequestEnemySpawn(SpawnableObjects.Instance.SlimeWithGunPool, spawnPoint);
         }
         for (int i = 0; i < spawn.slimes_with_melee; i++)
         {
             GameManager.Instance.RequestEnemySpawn(SpawnableObjects.Instance.SlimeWithMeleePool, spawnPoint);
         }
         for (int i = 0; i < spawn.ghosts; i++)
         {
             GameManager.Instance.RequestEnemySpawn(SpawnableObjects.Instance.GhostPool, spawnPoint);
         }
         for (int i = 0; i < spawn.ghosts_with_gun; i++)
         {
             GameManager.Instance.RequestEnemySpawn(SpawnableObjects.Instance.GhostWithGunPool, spawnPoint);
         }
         for (int i = 0; i < spawn.ghosts_with_melee; i++)
         {
             GameManager.Instance.RequestEnemySpawn(SpawnableObjects.Instance.GhostWithMeleePool, spawnPoint);
         }
     }
 }
Пример #8
0
    void Start()
    {
        audioSource = GetComponent <AudioSource> ();
        GameObject obj = GameObject.Find("GameControl");

        objWave = obj.GetComponent <SpawnWave>();
        player  = obj.GetComponent <GameController>().mainPlayer.transform;
    }
Пример #9
0
    public void InitializeLevel()
    {
        GetComponent <SetupScene>().availableBudget = spawnList[level].budget;
        nextState = gameObject.GetComponent <SetupScene>();
        SpawnWave spawnWaves = GetComponent <SpawnWave>();

        spawnWaves.spawnWave = spawnList[level].enemySpawnDetails;
    }
Пример #10
0
    //!this was for testing
    //public List<string> possiblewords;

    // Use this for initialization
    void Awake()
    {
        //!this was for testing
        //possiblewords = WordGenerator.WordList;
        spawner   = GetComponent <SpawnWord>();
        spawnWave = GetComponent <SpawnWave>();
        WordGenerator.PopulateWordList();
    }
Пример #11
0
 public void StartSpawner()
 {
     SpawnEnabled           = true;
     _waveTimer             = 0;
     _currentWave           = Waves[0];
     _currentWaveEnemyIndex = 0;
     _currentEnemy          = _currentWave.Spawns[0];
     _addTimeout            = _currentWave.AdditionalDelay;
 }
    private IEnumerator ExecuteSpawnState(SpawnWave spawnState)
    {
        yield return(new WaitForSeconds(spawnState.delay));

        foreach (SpawnField spawnField in spawnState.spawnFields)
        {
            StartCoroutine(ExecuteSpawnField(spawnField));
        }
    }
Пример #13
0
    public static void WaveComplete(SpawnWave w)
    {
        waveMan.waveCount--;

        if (waveMan.waveCount <= 0)
        {
            GameManager.OutOfWaves();
        }
    }
Пример #14
0
    IEnumerator CreateSpawnWave(Wave waveRef)
    {
        yield return(new WaitForSeconds(waveRef.spawnTimeAfterStart));

        GameObject gObj = Instantiate(spawnWavePrefab, transform);

        SpawnWave sw = gObj.GetComponent <SpawnWave> ();

        sw.waveRef = waveRef;
    }
Пример #15
0
 private void Start()
 {
     _currentWave = Waves.Count > 0 ? Waves[0] : null;
     if (_currentWave == null)
     {
         Debug.LogWarning("[INVALID SPAWN MANAGER] Add Waves to use SpawnManager");
         return;
     }
     waveIndex = 0;
     StartWave();
 }
 void NewWave(int waveNumber)
 {
     foreach (SpawnWave w in waves)                                  // Checks each wave
     {
         w.gameObject.SetActive(false);                              // Disables all waves
     }
     currentWave = waves[waveNumber];                                // Meant to advance wave by one
     waveActive  = false;                                            // Declares that there is not a wave active
     // waveStatus.text = prepareForWave + " " + waveNumber + 1; // Changes hud text to reflect no wave being active
     waveStatus.text = prepareForWave + (waveNumber + 1).ToString(); // Changes hud text to reflect no wave being active
 }
Пример #17
0
    void FillQueue()
    {
        SpawnWave wave = spawnWaves.Dequeue();

        foreach (string enemy in wave.enemies)
        {
            spawnQueue.Enqueue(enemy);
        }
        spawnDelay   = wave.startTime;
        currentDelta = wave.timeDelta;
        variantTimer = wave.timer;
    }
Пример #18
0
    // Use this for initialization
    void Start()
    {
        mainMusic = GetComponent <AudioSource>();

        mainMusic.Stop();
        this.GetComponent <AudioSource>().Play();
        spawnWave     = GameObject.FindObjectOfType <SpawnWave>();
        player        = FindObjectOfType <PlayerManager>();
        healthBar     = GetComponentInChildren <Slider>();
        MaxHealth     = 6;
        CurrentHealth = MaxHealth;
    }
    private SpawnWave GenerateSpawnState(SpawnWave previousSpawnWave)
    {
        int newWheight = GetNewWheight(previousSpawnWave.Wheight);

        int qttOfStuffed = 0;
        int qttOfRoll    = 0;
        int qttOfGolem   = 0;

        int atualWheight = 0;

        while (atualWheight < newWheight)
        {
            int rand = Random.Range(0, 3);

            switch (rand)
            {
            case 0:
                qttOfStuffed++;
                atualWheight += _stuffedCookie.Wheight;
                break;

            case 1:
                qttOfRoll++;
                atualWheight += _roolCookie.Wheight;
                break;

            case 2:
                qttOfGolem++;
                atualWheight += _golemCookie.Wheight;
                break;
            }
        }

        List <SpawnField> spawnFields = new List <SpawnField>();

        if (qttOfStuffed > 0)
        {
            spawnFields.Add(new SpawnField(0, _randomWavesDelay, qttOfStuffed, _stuffedCookie));
        }

        if (qttOfRoll > 0)
        {
            spawnFields.Add(new SpawnField(0, _randomWavesDelay, qttOfRoll, _roolCookie));
        }

        if (qttOfGolem > 0)
        {
            spawnFields.Add(new SpawnField(0, _randomWavesDelay, qttOfGolem, _golemCookie));
        }

        return(new SpawnWave(0, spawnFields.ToArray()));
    }
Пример #20
0
    private IEnumerator SpawnNextWave(SpawnWave wave)
    {
        _currentWave        = wave;
        _coffeeMakersAlive += wave.Count;

        yield return(new WaitForSeconds(wave.TimeBeforeFirstSpawn));

        yield return(SpawnCoffeeMakers(CoffeeMakerType.Cafetiere, wave.NumCafetieres, wave.TimeBetweenSpawns));

        yield return(SpawnCoffeeMakers(CoffeeMakerType.ItalianStove, wave.NumItalianStoves, wave.TimeBetweenSpawns));

        yield return(SpawnNextWave());
    }
Пример #21
0
        public void GotoWave(int waveIndex)
        {
            NextWaveStartTime = 0;
            currentWave = null;

            if (WaveCount <= 0)
                NextWaveIndex = 0;
            else if (waveIndex >= WaveCount)
                NextWaveIndex = WaveCount - 1;

            if (waveIndex < WaveCount)
                nextWave = waves[NextWaveIndex];
        }
Пример #22
0
 private void Update()
 {
     transform.position = Vector3.LerpUnclamped(startPosition, targetPosition, (Time.time - startTime) / Duration);
     if (transform.localPosition.y <= 0)
     {
         if (!invoked)
         {
             invoked = true;
             SpawnWave?.Invoke();
         }
         Destroy(gameObject, .5f);
     }
 }
Пример #23
0
    private void startWave(SpawnWave wave)
    {
        //Debug.Log ("WaveController::startWave");

        for (int i=0; i<_wave.units.Length; i++)
        {
            if (_wave.units[i].time == 0) {
                spawnUnit (_wave.units[i]);
            } else
            {
                StartCoroutine(initUnitSpawn(_wave.units[i]));
            }
        }
    }
Пример #24
0
    // Start is called before the first frame update
    void Start()
    {
        //!!!this looks like it will just get one of the random waves... is this what you want? If you want the variable from the current wave use that instead of get component. Talk to me if you need help -KE
        fireWave          = GetComponent <SpawnWave>().waveOfFire;
        trappedWave       = GetComponent <SpawnWave>().trapedFloor;
        fireFloor         = GetComponent <SpawnWave>().fireFloor;
        trapFloor         = GetComponent <SpawnWave>().trapFloor;
        currentWaveNumber = 0;
        currentWave       = null;
        waves             = GetComponents <SpawnWave>();

        enemiesSpawned = new List <AMS_Health_Management>();
        SetUpWave();
    }
Пример #25
0
        public void Spawn(StageSimulator stageSimulator)
        {
            foreach (var enemy in _enemies)
            {
                stageSimulator.Player.Targets.Add(enemy);
                stageSimulator.Characters.Enqueue(enemy, Simulator.TurnPriority / enemy.SPD);
                enemy.InitAI();
            }

            var enemies   = _enemies.Select(enemy => new Enemy(enemy)).ToList();
            var spawnWave = new SpawnWave(null, stageSimulator.WaveNumber, stageSimulator.WaveTurn, enemies, HasBoss);

            stageSimulator.Log.Add(spawnWave);
        }
Пример #26
0
    // Update is called once per frame
    void Update()
    {
        if (_addTimeout >= 0)
        {
            _addTimeout -= Time.deltaTime;
        }
        if (_waveTimer >= 0)
        {
            _waveTimer -= Time.deltaTime;
        }

        if (!SpawnEnabled)
        {
            return;
        }

        if (WaveCompleted())
        {
            Bonus.SpawnBonus(_currentWave.FinalBonus, Vector3.zero);
            GameManager.Instance.WavePassed(_currentWaveIndex);
            _currentWaveIndex++;
            if (_currentWaveIndex >= Waves.Count)
            {
                GameManager.Instance.GameEnded(false);
                Debug.Log("Finished game");
                SpawnEnabled = false;
                return;
            }
            else
            {
                _currentWave           = Waves[_currentWaveIndex];
                _addTimeout            = _currentWave.AdditionalDelay;
                _currentEnemy          = _currentWave.Spawns[0];
                _currentWaveEnemyIndex = 0;
            }
        }
        else
        {
            if (_waveTimer <= 0)
            {
                SpawnWave();
            }

            if (CanSpawnAdditionalEnemy())
            {
                SpawnAdditionalEnemy();
            }
        }
    }
Пример #27
0
    private void startWave(SpawnWave wave)
    {
        //Debug.Log ("WaveController::startWave");

        for (int i = 0; i < _wave.units.Length; i++)
        {
            if (_wave.units[i].time == 0)
            {
                spawnUnit(_wave.units[i]);
            }
            else
            {
                StartCoroutine(initUnitSpawn(_wave.units[i]));
            }
        }
    }
    private IEnumerator SpawnLoop(SpawnWave previousWave)
    {
        bool isFirst = true;

        while (GameManager.Instance.IsPlaying)
        {
            if (!isFirst)
            {
                yield return(new WaitForSeconds(previousWave.TotalDuration));
            }

            SpawnWave spawnWave = GenerateSpawnState(previousWave);
            StartCoroutine(ExecuteSpawnState(spawnWave));
            previousWave = spawnWave;
            isFirst      = false;
        }
    }
Пример #29
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Return))
     {
         spawnWaveIndex += 1;
         if (spawnWaveIndex < SpawnWaves.Count)
         {
             currentWave = SpawnWaves[spawnWaveIndex];
             currentWave.PrepareWave();
             StartCoroutine(StartSpawn());
         }
         else
         {
             Debug.Log("NO MORE WAVES");
         }
     }
 }
Пример #30
0
    public void Update()
    {
        if (waves.Count == 0)
        {
            if (!roundOver)
            {
                //if(enemies.Length == 0){
                if (GameLogic.EnemyCount == 0)
                {
                    // Debug potential error
                    GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
                    if (enemies.Length != 0)
                    {
                        Debug.LogError("ERROR: Enemy Count should be 0!!!");
                    }

                    roundEndTimer = 5.0f;
                    roundOver     = true;
                    Camera.main.GetComponent <PrintMessage>().printMessage("Round Complete", 5.0f);
                }
            }

            if (roundEndTimer > 0.0f)
            {
                roundEndTimer -= Time.deltaTime;
            }

            return;
        }

        SpawnWave wave = waves [0];

        // Update Wave
        wave.Update();

        // Wave Complete
        if (wave.IsComplete())
        {
            waves.RemoveAt(0);
            ++GameLogic.waveNumber;
        }
    }
Пример #31
0
    public IEnumerator BeginSpawnWave(int waveIndex)
    {
        if (waveIndex < waves.Count())
        {
            m_CurrentWave = waves[waveIndex];
            yield return(StartCoroutine(SpawnLoop()));

            // Little hacky, but it'll do for now
            WaveGenerator w = FindObjectOfType <WaveGenerator>();
            if (w != null)
            {
                w.isWaveActive = false;
            }
            else
            {
                WaveGeneratorTutorial t = FindObjectOfType <WaveGeneratorTutorial>();
                t.isWaveActive = false;
            }
        }
    }
Пример #32
0
    public void init(LevelEnemyWorker enemyControl, SpawnWave wave, Transform moveFinalTarget)
    {
        //Debug.Log ("WaveController::init time="+wave.time);
        this.moveFinalTarget = moveFinalTarget;
        _wave = wave;
        _enemyControl = enemyControl;

        leftSpawnUnits = 0;
        for (int i=0; i<_wave.units.Length; i++)
        {
            leftSpawnUnits+=_wave.units[i].count;
        }

        if (_wave.time == 0) {
            startWave (_wave);
        } else
        {
            StartCoroutine(initSpawnWave(_wave));
        }
    }
Пример #33
0
    IEnumerator DestroyEnemies()
    {
        SwipeDestroyingEnemy = true;
        SpawnWave  objsw   = GetComponent <SpawnWave>();
        GameObject objShip = null;

        if (sid != null)
        {
            if (sid.Count > 0)
            {
                foreach (int id in sid)
                {
//                    Debug.Log("lista: " + id.ToString());
                    for (int i = 0; i < objsw.pooledShipsA.Count; i++)
                    {
                        objShip = objsw.pooledShipsA[i];
                        int pid = objShip.GetComponent <ShipControl>().shipID;
                        if (pid == id)
                        {
                            objShip.SetActive(false);
                            objShip.GetComponent <EnemyWeaponController> ().CancelInvokes();
                            if (explosionEnemy != null)
                            {
                                Vector3 vector = GameObject.Find("MainCamera").GetComponent <Camera>().WorldToScreenPoint(objShip.transform.position);
                                Instantiate(explosionEnemy, objShip.transform.position, objShip.transform.rotation);
                            }
                            break;
                        }
                    }
                    yield return(new WaitForSeconds(0.2f));
                }
            }
        }


        sid = new List <int>();
        yield return(new WaitForEndOfFrame());

        SwipeDestroyingEnemy = false;
    }
Пример #34
0
 public void Activate(Scene scene, float time)
 {
     if (currentWave != null)
     {
         bool finished = currentWave.Activate(scene, time);
         if (finished)
             currentWave = null;
     }
     else if (nextWave != null && NextWaveStartTime <= time)
     {
         nextWave.Start(time);
         currentWave = nextWave;
         NextWaveIndex += 1;
         if (NextWaveIndex < WaveCount)
         {
             nextWave = waves[NextWaveIndex];
             NextWaveStartTime = time + waveIntervalTime;
         }
         else
         {
             nextWave = null;
         }
     }
 }
Пример #35
0
    void GetSpawnRound(int roundIndex)
    {
        SpawnWave wave;
        round = new SpawnRound();

        if (roundIndex == 0) {
            // Wave 1
            wave = new SpawnWave();
            wave.spawnTime = 2.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 3, 1));
            if(spawnRoundNumber == 0){
                wave.startFunction = () => {
                    Camera.main.GetComponent<PrintMessage>().printMessage("Left Stick: Move\n\nRight Stick: Shoot", 15.0f);
                };
            }
            round.waves.Add(wave);

            // Wave 2
            wave = new SpawnWave();
            wave.spawnTime = 5.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 8, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 3, 2));
            round.waves.Add(wave);

            // Wave 3
            wave = new SpawnWave();
            wave.spawnTime = 8.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 12, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 8, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 2, 4));
            round.waves.Add(wave);

            // Wave 4
            wave = new SpawnWave();
            wave.spawnTime = 10.0f;
            wave.enemySets.Add (new EnemySet("SplitEnemy", 2, 1));
            if(spawnRoundNumber == 0){
                Player.canSplit = true;
            }
            round.waves.Add(wave);

            // Wave 5
            wave = new SpawnWave();
            wave.spawnTime = 10.0f;
            wave.enemySets.Add (new EnemySet("SplitEnemy", 2, 1));
            if(spawnRoundNumber == 0){
                wave.startFunction = () => {
                    Camera.main.GetComponent<PrintMessage>().printMessage("XBox Bumpers:\nSplit your ship appart!\n\nCut large enemies in half", 20.0f);
                };
            }
            round.waves.Add(wave);

            // Wave 6
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("EnemyBlob", 1, 100));
            wave.waitForEnemies = true;
            wave.startFunction = () => {
                Camera.main.GetComponent<PrintMessage>().printMessage("Boss Wave", 5.0f);
            };
            round.waves.Add(wave);

        }
        else if (roundIndex == 1) {
            // Wave 1
            wave = new SpawnWave();
            wave.spawnTime = 5.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 8, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 3, 2));
            round.waves.Add(wave);

            // Wave 2
            wave = new SpawnWave();
            wave.spawnTime = 8.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 12, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 8, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 2, 4));
            round.waves.Add(wave);

            // Wave 3
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 8, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 3, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 2, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 2, 1));
            round.waves.Add(wave);

            // Wave 4
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 8, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 3, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 2, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 8, 2));
            round.waves.Add(wave);

            // Wave 5
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("EnemyBlob", 2, 100));
            wave.waitForEnemies = true;
            wave.startFunction = () => {
                Camera.main.GetComponent<PrintMessage>().printMessage("Boss Wave", 5.0f);
            };
            round.waves.Add(wave);

        }
        else if (roundIndex == 2) {
            // Wave 1
            wave = new SpawnWave();
            wave.spawnTime = 8.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 12, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 8, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 2, 4));
            round.waves.Add(wave);

            // Wave 2
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 8, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 3, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 2, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 2, 1));
            round.waves.Add(wave);

            // Wave 3
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 20, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 10, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 8, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 8, 3));
            round.waves.Add(wave);

            // Wave 4
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 20, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 10, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 8, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 8, 1));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 6, 2));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 4, 3));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 2, 4));
            round.waves.Add(wave);

            // Wave 5
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("EnemyBlob", 3, 100));
            wave.waitForEnemies = true;
            wave.startFunction = () => {
                Camera.main.GetComponent<PrintMessage>().printMessage("Boss Wave", 5.0f);
            };
            round.waves.Add(wave);

        }
        /*
        else if (roundIndex == 3) {
            // Wave 1
            wave = new SpawnWave();
            wave.spawnTime = 2.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 20, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 2));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 3, 1));
            round.waves.Add(wave);

            // Wave 2
            wave = new SpawnWave();
            wave.spawnTime = 20.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 30, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 10, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 3));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 6, 1));
            round.waves.Add(wave);

            // Wave 3
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 40, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 20, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 10, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 5, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 8, 1));
            round.waves.Add(wave);

            // Wave 4
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 50, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 30, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 20, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 15, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 10, 1));
            round.waves.Add(wave);

            // Wave 5
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("EnemyBlob", 4, 100));
            wave.waitForEnemies = true;
            wave.startFunction = () => {
                Camera.main.GetComponent<PrintMessage>().printMessage("Boss Wave", 5.0f);
            };
            round.waves.Add(wave);
        }
        */
        else// (roundIndex == 3)
        {
            int extra = (roundIndex-1) * 5;

            // Wave 1
            wave = new SpawnWave();
            wave.spawnTime = 2.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 20 + extra, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 5 + extra, 2));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 3 + extra, 1));
            round.waves.Add(wave);

            // Wave 2
            wave = new SpawnWave();
            wave.spawnTime = 20.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 30 + extra, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 10 + extra, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 5 + extra, 3));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 6 + extra, 1));
            round.waves.Add(wave);

            // Wave 3
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 40 + extra, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 20 + extra, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 10 + extra, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 5 + extra, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 8 + extra, 1));
            round.waves.Add(wave);

            // Wave 4
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 50 + extra, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 30 + extra, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 20 + extra, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 15 + extra, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 10 + extra, 1));
            round.waves.Add(wave);

            // Wave 5
            /*
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("Enemy", 50 + extra, 1));
            wave.enemySets.Add (new EnemySet("Enemy", 40 + extra, 2));
            wave.enemySets.Add (new EnemySet("Enemy", 30 + extra, 3));
            wave.enemySets.Add (new EnemySet("Enemy", 25 + extra, 4));
            wave.enemySets.Add (new EnemySet("SplitEnemy", 12 + extra, 1));
            round.waves.Add(wave);
            */

            // Wave 5
            wave = new SpawnWave();
            wave.spawnTime = 30.0f;
            wave.enemySets.Add (new EnemySet("EnemyBlob", extra, 50));
            wave.waitForEnemies = true;
            wave.startFunction = () => {
                Camera.main.GetComponent<PrintMessage>().printMessage("Boss Wave", 5.0f);
            };
            round.waves.Add(wave);
        }
    }
Пример #36
0
 private IEnumerator initSpawnWave(SpawnWave wave)
 {
     yield return new WaitForSeconds(wave.time);
     startWave(wave);
 }
Пример #37
0
        public void Load(SpawnSetting setting)
        {
            if (setting == null)
                return;

            waveIntervalTime = setting.WaveIntervalTime;

            Dictionary<int, SpawnWave> waveDict = new Dictionary<int, SpawnWave>();
            foreach (var locationSetting in setting.Locations)
            {
                foreach (var waveSetting in locationSetting.Waves)
                {
                    SpawnWave wave;
                    if (!waveDict.TryGetValue(waveSetting.WaveIndex, out wave))
                    {
                        wave = new SpawnWave();
                        waveDict.Add(waveSetting.WaveIndex, wave);
                    }

                    SpawnEntry entry = new SpawnEntry();
                    entry.PathIndex = locationSetting.PathIndex;
                    entry.DelayTime = waveSetting.DelayTime;
                    entry.IntervalTime = waveSetting.IntervalTime;
                    entry.SpawnTimes = waveSetting.SpawnTimes;
                    entry.SpawnPerTime = waveSetting.SpawnPerTime;
                    entry.TemplateID = waveSetting.TemplateID;
                    wave.Entries.Add(entry);
                }
            }
            waves = waveDict.Values.ToList();

            WaveCount = waves.Count;
        }