示例#1
0
    void Update()
    {
        UpdateUI();

        if (Input.GetKey("r"))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }

        _waveManager.ExecuteCurrentWave();
        if (_waveManager.CurrentWave.Ended)
        {
            // handle wave powerUp if present
            if (_waveManager.CurrentWave.Definition.HasPowerUp)
            {
                var pos         = ScreenHelper.GetRandomScreenPoint(y: EnemySpawnPoint.transform.position.y);
                var powerUpType = _waveManager.CurrentWave.Definition.PowerUp;
                _powerUpFactory.Create(powerUpType, pos);
            }

            _waveManager.MoveNext();
        }

        if (_difficultyManager.CanCreateAsteroid())
        {
            _difficultyManager.NotifyEnemyTypeSelected(EnemyType.Asteroid1);
            var pos = ScreenHelper.GetRandomScreenPoint(y: EnemySpawnPoint.transform.position.y);
            _enemyFactory.Create(EnemyType.Asteroid1, pos);
        }
    }