private IEnumerator LevelState() { gameOverPanel.DisableGameOverPanel(); startTextPanel.SetActive(true); yield return(WaitForPlayerInitialInput()); startTextPanel.SetActive(false); FindObjectOfType <AudioHandler>().PlayEffect(4); while (IsPlayerAlive() && !IsLevelFinished()) { if (!IsGamePaused()) { player.Action(); } yield return(new WaitForFixedUpdate()); } if (!IsPlayerAlive()) { musicHandler.ChangePitch(gameOverPitch); StartCoroutine(gameOverPanel.Appear()); } else if (IsLevelFinished()) { SaveAndLoad.FinishAndSaveLevel(collectedCoins == Coin.totalCoin, collectedCoins == 0); player.Stop(); yield return(new WaitForSeconds(player.timeToFinish)); endLevelPanel.SetActive(true); } Coin.ResetTotalCoin(); collectedCoins = 0; }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } if (PlayerPrefs.HasKey("LevelId")) { currentLevel = PlayerPrefs.GetInt("LevelId"); } else { PlayerPrefs.SetInt("LevelId", currentLevel); } if (PlayerPrefs.HasKey("HighestScore")) { bestScore = PlayerPrefs.GetInt("HighestScore"); } else { PlayerPrefs.SetInt("HighestScore", bestScore); } if (PlayerPrefs.GetInt("UseMenu").Equals(1) || !PlayerPrefs.HasKey("UseMenu")) { StartPanel.SetActive(true); PlayerPrefs.SetInt("UseMenu", 1); } else if (PlayerPrefs.GetInt("UseMenu").Equals(0)) { InGamePanel.SetActive(true); } if (!PlayerPrefs.HasKey("VIBRATION")) { PlayerPrefs.SetInt("VIBRATION", 1); VibrationButton.GetComponent <Image>().sprite = on; } else { if (PlayerPrefs.GetInt("VIBRATION") == 1) { VibrationButton.GetComponent <Image>().sprite = on; } else { VibrationButton.GetComponent <Image>().sprite = off; } } if (SoundManager.Instance == null) { Instantiate(soundManager); } BestScoreText.text = currentScore.ToString(); InitializeLevel(); }
public void Start() { paused = false; gameEnded = false; pausePanel.SetActive(false); StartPanel.SetActive(true); WinPanel.SetActive(false); }
IEnumerator GameStart() { while (!Input.GetKeyDown(KeyCode.Space) && !Input.GetKeyDown(KeyCode.JoystickButton1)) { yield return(null); } StartPanel.SetActive(false); if (pool.CardCreate()) { StartCoroutine(PointSet()); } }
public void InitNewGame() { if (StartPanel) { StartPanel.SetActive(true); } GameTitle.text = GameParameters.GameName; CurrentLocation = null; HideTemplates(); DeactivateButton(StartButton); FillLocations(); }
private void LoadBeatmapInfo() { artistText.text = CurrentBeatmaps[CurrentIndex].Artist; authorText.text = CurrentBeatmaps[CurrentIndex].Author; densityText.text = CurrentBeatmaps[CurrentIndex].Density.ToString(); //Debug.Log(CurrentBeatmaps[CurrentIndex].FilePath); animationObj.Play("SelectSong_BeatmapSelected", 0, 0); if (!DensityPanel.activeSelf) { DensityPanel.SetActive(true); } if (!OptionPanel.activeSelf) { OptionPanel.SetActive(true); } if (!StartPanel.activeSelf) { StartPanel.SetActive(true); } }
//Начать игру public void StartGame() { StartPanel.SetActive(false); GameStarted(currentLocation); }
void StartGame() { StartPanel.SetActive(false); Controller.instance.StartGame(); }
void pause() { paused = !paused; pausePanel.SetActive(paused); StartPanel.SetActive(false); }