Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        time -= Time.deltaTime;
        if (time < 0)
        {
            float x   = Random.RandomRange(leftSpawn.transform.position.x, rightSpawn.transform.position.x);
            float y   = leftSpawn.transform.position.y;
            int   obj = Random.Range(0, 3);

            GameObject o = Instantiate(gos[obj], new Vector3(x, y, 1), new Quaternion());
            o.tag    = "Friut";
            o.active = true;
            time     = timeBetwenSpawns;
        }

        inGameUi.setScoreText("Score: " + score);

        inGameUi.setMissedText("Missed: " + missed);

        if (missed >= maxMissed)
        {
            gameOver(false);
        }
        else if (score >= winScore)
        {
            gameOver(true);
        }
    }