Beispiel #1
0
    private void DeActivateObjects()
    {
        this.GameOverObject = GameObject.FindGameObjectWithTag("Finish");
        GameOverObject.SetActive(false);

        this.StartObject.SetActive(false);
    }
Beispiel #2
0
    void NewPoint()
    {
        if (Time.timeScale == 1f)
        {
            int i = Random.Range(0, 2);
            if (GameOverObject.active == false && WinningObject.active == false)
            {
                if (i == 0)
                {
                    if (GameOverObject.active == false)
                    {
                        Vector2 pos = new Vector2(UnityEngine.Random.Range(-93, 94), UnityEngine.Random.Range(-191, 141));
                        GameOverObject.GetComponent <RectTransform>().localPosition = pos;
                        GameOverObject.SetActive(true);
                        TimeLeft = 1f;
                        BadCounter();
                    }
                }

                else if (i == 1)
                {
                    if (WinningObject.active == false)
                    {
                        Vector2 pos = new Vector2(UnityEngine.Random.Range(-93, 94), UnityEngine.Random.Range(-191, 141));
                        WinningObject.GetComponent <RectTransform>().localPosition = pos;
                        WinningObject.SetActive(true);
                    }
                }
            }
        }
    }
    }//End Load Method

    public void GameOver()
    {
        if (score > highScore)
        {
            highScore = score;
            PlayerPrefs.SetInt("highscore", highScore);
        }
        GameOverObject.SetActive(true);
    }
Beispiel #4
0
 void BadCounter()
 {
     TimeLeft -= Time.deltaTime;
     if (TimeLeft <= 0f)
     {
         GameOverObject.SetActive(false);
         NewPoint();
     }
 }