private void EndLevel(LEVEL_STATE state) { SetGameStarted(false); ResetUI(); StopTimer(); EndLevelActions(state); }
private string SetupEndLevelText(LEVEL_STATE state) { string endLevelText = GetEndLevelText(props.endLevelWinText); if (state != LEVEL_STATE.WIN) { endLevelText = GetEndLevelText(props.endLevelLoseText); } return(endLevelText); }
private Color SetupEndLevelTextColor(LEVEL_STATE state) { Color color = props.winEndLevelTextColor; if (state != LEVEL_STATE.WIN) { color = props.loseEndLevelTextColor; } return(color); }
private void PlayEndLevelSound(LEVEL_STATE state) { AudioSource endLevelSound = props.winSound; if (state != LEVEL_STATE.WIN) { endLevelSound = props.loseSound; } endLevelSound.Play(); }
private void PlayEndLevelSound(LEVEL_STATE state) { if (state != LEVEL_STATE.WIN) { props.loseSound.Play(); } else { props.winSound.Play(); } }
private void ShowEndLevelText(LEVEL_STATE state) { string endLevelText = props.winText[Random.Range(0, props.loseText.Capacity)]; Color endLevelColor = props.winColor; if (state != LEVEL_STATE.WIN) { endLevelText = props.loseText[Random.Range(0, props.loseText.Capacity)]; endLevelColor = props.loseColor; } UI.ShowEndLevelText(endLevelText, endLevelColor); }
private void EndLevelActions(LEVEL_STATE state) { if (state == LEVEL_STATE.LOSE) { DropAllShapes(); } if (state == LEVEL_STATE.WIN) { difficultyLevel++; uiLevel++; if (difficultyLevel > props.maxDifficultyLevel) { difficultyLevel = props.maxDifficultyLevel; } } ShowEndLevelText(state); PlayEndLevelSound(state); StartCoroutine(NextLevel()); }
/// <summary> /// Changes the level state /// </summary> /// <param name="NewState">The new level state</param> private void LevelStateChange(LEVEL_STATE NewState) { this.currentState = NewState; LevelStateChangeEventArgs args = new LevelStateChangeEventArgs(); args.NewState = NewState; switch (NewState) { // The game is over show game over screen case LEVEL_STATE.GAME_OVER: case LEVEL_STATE.GAME_WON: break; case LEVEL_STATE.PLAY: InitLevel(); break; default: Debug.Log("🌮🌮🌮🌮 UNKNOWN LEVEL STATE 🌮🌮🌮🌮"); break; } OnLevelStateChangeEvent?.Invoke(this, args); }
public void EndLevel(LEVEL_STATE state, MoveToCube choosenOne) { timer.StopTick(); choosen = choosenOne; endLevelState = state; }
/// <summary> /// Changes the level state to the provided state /// </summary> /// <param name="state">state to change too</param> public void ChangeLevelState(LEVEL_STATE state) { Instance.LevelStateChange(state); }