示例#1
0
    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;
        }
    }
示例#2
0
 private void Awake()
 {
     if (Singleton != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Singleton = this;
     }
 }
示例#3
0
        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);
        }
示例#4
0
    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);
        }
    }
示例#5
0
    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;
        }
    }
示例#6
0
    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);
        }
    }
示例#7
0
    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;
        }
    }