// Start is called before the first frame update void Start() { _timeoutReal = Time.time + _timeoutValue; mainMenu.SetActive(true); SetMusic?.Invoke(_menuMusic, 1f); _score = 0; scoreText.text = _score.ToString(); tailLengthText.text = "0"; immunLeftText.text = "0"; _lastChanceTextTip = lastChanceMenu.transform.Find("To Continue").GetComponent <Text>(); _highScore = PlayerPrefs.GetInt("HighScore"); if (_highScore != 0) { highScoreText.text = _highScore.ToString(); scoreContainer.SetActive(true); } //Debug.Log($"Happy = {PlayerPrefs.GetInt("happy")}"); if (PlayerPrefs.HasKey("happy")) { if (PlayerPrefs.GetInt("happy") != 0) { HideShopButton(); } } debugTextObj = transform.Find("Menu").Find("Debug Text Obj").GetComponent <Text>(); }
public void WinGame() { SetMusic?.Invoke(_winMusic, 0.8f); gameMenu.SetActive(false); winGameMenu.SetActive(true); SetHighScore(); Debug.Log("Game Win"); }
public void LooseGame() { ShowUsualAdd(); SetMusic?.Invoke(_loseMusic, 1f); gameMenu.SetActive(false); looseGameMenu.SetActive(true); SetHighScore(); Debug.Log("Your are Losser!"); }
public void ShowMenu() { looseGameMenu.SetActive(false); playSound?.Invoke(_buttonSound); snake.SetSpriteRendererActive(true); SetHighScore(); ResetScore(); _timeoutReal = Time.time + _timeoutValue; mainMenu.SetActive(true); SetMusic?.Invoke(_menuMusic, 1f); Debug.Log("ShowMenu"); }
//Collback function public void RestartGame() { playSound?.Invoke(_buttonSound); SetMusic?.Invoke(_gameMusic, 1f); ResetScore(); snake.SetSpriteRendererActive(true); looseGameMenu.SetActive(false); gameMenu.SetActive(true); adsController.ResetAdsState(); snake.ChangeGameState(true); Debug.Log("Game Restart"); }
private void StartGame() { playSound?.Invoke(_buttonSound); mainMenu.SetActive(false); gameMenu.SetActive(true); SetMusic?.Invoke(_gameMusic, 1f); adsController.ResetAdsState(); if (!isTipsEnable) { snake.ChangeGameState(true); } else { Snake.curGameState = Snake.GameState.TipPause; } }