// Update is called once per frame void Update() { if (State == GameLogicState.Play) { checkMatch(); _colorPoints = Mathf.Max(_colorPoints - Time.deltaTime * 50, 10); _time -= Time.deltaTime; _timeTransform.anchorMax = new Vector2(_time / _maxTime, _timeTransform.anchorMax.y); if (!_timeCritical && _time / _maxTime <= 0.2) { _timeCritical = true; _timeAnimator.SetBool("critical", true); } if (_timeCritical && _time / _maxTime > 0.2) { _timeCritical = false; _timeAnimator.SetBool("critical", false); } if (_time <= 0.0f) { GameMixer.Instance.ClearColor(); State = GameLogicState.End; _mainText.text = "FIN"; _endCanvas.alpha = 1.0f; _endCanvas.interactable = true; _endCanvas.blocksRaycasts = true; if (string.IsNullOrEmpty(Settings.PlayerName)) { _sendScoreText.text = "please set a player name in the main menu to submit high scores"; } else { _sendScoreText.text = "submitting score..."; StartCoroutine(HighscoreManager.PostScore(Settings.PlayerName, _score, (int)Settings.Mode, Application.isMobilePlatform, () => { _sendScoreText.text = "score sucessfully submitted" + Environment.NewLine + "loading placement..."; StartCoroutine(HighscoreManager.GetPlacement(Settings.PlayerName, (int)Settings.Mode, Application.isMobilePlatform, s => { _sendScoreText.text = "score sucessfully submitted" + Environment.NewLine + s; }, s => { _sendScoreText.text = "score sucessfully submitted" + Environment.NewLine + s; })); }, s => { _sendScoreText.text = s; })); } } } }
public void SwitchState(GameLogicState toState) { this.state = toState; stateTime = 0.0f; switch (toState) { case GameLogicState.PlayingAvatar: universeCamera.FollowObject(universeView.avatarView.trans, FollowCameraParameters.FollowRotation | FollowCameraParameters.FollowScale, true); break; case GameLogicState.PlayingShip: universeCamera.FollowObject(universeView.shipView.trans, FollowCameraParameters.None, true); break; } }
private IEnumerator Countdown() { float delay = 0.5f; _mainText.text = "3"; yield return(new WaitForSeconds(delay)); _mainText.text = "2"; yield return(new WaitForSeconds(delay)); _mainText.text = "1"; yield return(new WaitForSeconds(delay)); _mainText.text = "GO"; nextColor(); State = GameLogicState.Play; yield return(new WaitForSeconds(delay)); _mainText.text = ""; }
private void ChangeState(GameLogicState _newState) { Assert.NotNull(_newState, "Can't set a null state"); m_currentGameState = _newState; m_currentGameState.EnterState(); }
/// <summary> /// ゲームプレイ時の初期化関数. /// </summary> void InitGamePlay() { // BGM再生. SoundManager.Instance.PlayBGM(0); // ゲームロジックの状態を代入. myState = GameLogicState.GamePlay; // プレイヤーをフリーズ. kinoko.FreezeFlag = false; // 地形をフリーズ. ground.FreezeFlag = false; // スライダーをフリーズ. gaugeSlider.FreezeFlag = false; // スタートテキストをオフ. StartText.enabled = false; }
/// <summary> /// ゲームスタート時の処理. /// </summary> void GameStart() { // ゲームロジックの状態を代入. myState = GameLogicState.GameStart; // プレイヤーをフリーズ. kinoko.FreezeFlag = true; // 地形をフリーズ. ground.FreezeFlag = true; // スライダーをフリーズ. gaugeSlider.FreezeFlag = true; }
/// <summary> /// ゲーム終了時の処理. /// </summary> void GameOver() { // BGM停止. SoundManager.Instance.StopBGM(); // SE再生. SoundManager.Instance.PlaySE(0); myState = GameLogicState.GameOver; // 地形の更新をやめる. ground.FreezeFlag = true; // スライダーをフリーズ. gaugeSlider.FreezeFlag = true; // EndTextをオン. EndText.enabled = true; Debug.Log("GameOver"); }
/// <summary> /// ゲームクリアー時の処理. /// </summary> void GameClear() { // BGM停止. SoundManager.Instance.StopBGM(); // SE再生. SoundManager.Instance.PlaySE(1); myState = GameLogicState.GameClear; // 地形の更新をやめる. ground.FreezeFlag = true; // きのこをゴール処理させる. kinoko.isGoal = true; Debug.Log("GameClear"); }