// Use this for initialization void Start () { State = RoomSpawnerState.NotActivate; _originalPosition = this.transform.position; _endPosition = new Vector3(_originalPosition.x, 1, _originalPosition.z); Enemies = new BaseEnemy[EnemiesPerRound * Rounds]; }
// Update is called once per frame void Update () { switch(State) { case RoomSpawnerState.NotActivate: break; case RoomSpawnerState.Activating: MoveUpDown(Vector3.up); Shake(); if (transform.position.y >= _endPosition.y){ transform.position = _endPosition; State = RoomSpawnerState.Activated; } break; case RoomSpawnerState.Activated: if (!SpawnStarted) { this.SpawnEnemies(); SpawnStarted = true; } break; case RoomSpawnerState.Finishing: MoveUpDown(Vector3.down); Shake(); if (transform.position.y <= 6f) // Verificar o fim do mapa { this.State = RoomSpawnerState.Finished; } break; } }
private void BaseEnemy_OnDie(BaseEnemy enemy_) { baseEnemyCount--; enemy_.OnBeforeDie -= this.BaseEnemy_OnDie; if (this.IsFinished) this.State = RoomSpawnerState.Finishing; }