// Update is called once per frame void Update() { if (_gameMaster.CurrentState == GameState.WaveEnded) { if (!_uiEnemy.IsOffscreen()) { if (!_slideSoundPlayed) { _audioSystem.EnemySlide(); _slideSoundPlayed = true; } _uiEnemy.MoveOffscreen(); } else { if (_uiMid.IsOnScreen()) { if (!_slideSoundPlayed2) { _audioSystem.EnemySlide(); _slideSoundPlayed2 = true; } _uiMid.SlideOut(); } else { if (_battleManager.AtEndOfGame()) { _battleManager.EndGameCount++; _gameMaster.TransitionTo(GameState.WaveStarted); } else { if (_battleManager.OnFinalWaveOfBattle()) { _gameMaster.TransitionTo(GameState.Shopping); } else { _battleManager.NextWave(); _gameMaster.TransitionTo(GameState.WaveStarted); } } } } } }
// Update is called once per frame void Update() { if (_gameMaster.CurrentState == GameState.WaveStarted) { if (_currentAnnouncementTime < _announcementTime) { _waveAnnouncementPanel.gameObject.SetActive(true); float quarterTime = (_announcementTime / 4); float alpha = _currentAnnouncementTime / quarterTime; if (_currentAnnouncementTime > quarterTime) { alpha = 1; } if (_currentAnnouncementTime > quarterTime * 3) { alpha = 1 - (_currentAnnouncementTime - quarterTime * 3); } var panelColour = _waveAnnouncementPanel.color; panelColour.a = alpha * 0.75f; _waveAnnouncementPanel.color = panelColour; _currentAnnouncementTime += Time.deltaTime; _battleAnnouncementText.text = _battleManager.GetCurrentBattle().BattleName; _waveAnnouncementText.text = "Wave " + (_battleManager.WaveNumber + 1 + _battleManager.EndGameCount).ToString() + " / " + _battleManager.GetCurrentBattle().GetNumberOfWaves(); if (_battleManager.AtEndOfGame()) { _waveAnnouncementText.text = "Wave " + (_battleManager.WaveNumber + 1 + _battleManager.EndGameCount).ToString() + " / " + "???"; } var textColour = _battleAnnouncementText.color; textColour.a = alpha; _battleAnnouncementText.color = textColour; textColour = _waveAnnouncementText.color; textColour.a = alpha; _waveAnnouncementText.color = textColour; } else { _waveAnnouncementPanel.gameObject.SetActive(false); if (_uiEnemy.IsOffscreen()) { if (!_slideSoundPlayed) { _audioSystem.EnemySlide(); _slideSoundPlayed = true; } _uiEnemy.MoveOnscreen(); } else { _uiSpeechbubble.SetActive(true); _speechBubbleTime -= Time.deltaTime; _uiSpeechText.text = _enemy.BaseEnemy.EnemyDialogue; if (!_speechSoundPlayed) { _speechSoundPlayed = true; _audioSystem.EnemyEnterSound(); } if (_inputController.ConfirmPressed()) { _speechBubbleTime = -1; } if (_speechBubbleTime < 0) { _uiSpeechbubble.SetActive(false); if (!_uiMid.IsOnScreen()) { if (!_slideSoundPlayed2) { _audioSystem.EnemySlide(); _slideSoundPlayed2 = true; } _uiMid.SlideIn(); } else { _gameMaster.TransitionTo(GameState.Battling); } } } } } }