void CheckWhetherYouWin() { if (HasAnybodyWon == WhoWon.PlayerWon) { HudPanel.SetActive(false); LosePanel.SetActive(false); WinPanel.SetActive(true); WinScore.text = Mathf.RoundToInt(Time.time - TimeElasped).ToString(); if (LastHighScore < Mathf.RoundToInt(Time.time - TimeElasped)) { WinHighScore.text = "BEST TIME : " + LastHighScore.ToString(); } else { WinHighScore.text = "BEST TIME : " + Mathf.RoundToInt(Time.time - TimeElasped).ToString(); PlayerPrefs.SetInt(highScoreKey, Mathf.RoundToInt(Time.time - TimeElasped)); } HasAnybodyWon = WhoWon.NobodyYet; } }
private void Awake() { if (Singleton != null) { Destroy(gameObject); } else { Singleton = this; } }
private void Update() { // Wait for the winner's number to update, then display it. if (_whoWon) { return; } _whoWon = FindObjectOfType <WhoWon>(); var winner = _whoWon.GetWinnerNumber(); _text.text = string.Format(_displayFormat, winner); }
private void SetWinner() { WhoWon whoWon = new WhoWon(); if (whoWon.Winner.Equals("Bat")) { bat.SetActive(true); } else if (whoWon.Winner.Equals("Bunny")) { bunny.SetActive(true); } else if (whoWon.Winner.Equals("Duck")) { duck.SetActive(true); } else if (whoWon.Winner.Equals("Chicken")) { chicken.SetActive(true); } }
void CheckWhetherYouLost() { if (HasAnybodyWon == WhoWon.EnemyWon) { HudPanel.SetActive(false); WinPanel.SetActive(false); LosePanel.SetActive(true); if (LastHighScore == 1000000) { LoseHighScore.gameObject.SetActive(false); } else { LoseHighScore.gameObject.SetActive(true); LoseHighScore.text = "BEST TIME : " + LastHighScore.ToString(); } HasAnybodyWon = WhoWon.NobodyYet; } }
void PreStart() { if (IsStartGame) { return; } StartCounterText.text = Mathf.RoundToInt(startCounter).ToString(); startCounter -= Time.deltaTime; if (startCounter <= 0f) { IsStartGame = true; IsGameOver = false; HasAnybodyWon = WhoWon.NobodyYet; StartPanel.SetActive(false); TimeElasped = Time.time; HudPanel.SetActive(true); } }
private IEnumerator WaitForChest(ParticleSystem animation) { do { yield return(null); } while (animation.isPlaying); _equipment.DeleteKey(40); _equipment.AddGoblet(); _soundManager.PlayCollectSound(); Chest chest = GameObject.Find("Chest").GetComponent <Chest>(); chest.changePosition = true; if (_equipment.GETGobletsCount() == 4) { WhoWon whoWon = new WhoWon(); whoWon.Winner = gameObject.name; GameControl.GameOver = true; } else { _stopForChest = false; } }