Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        time = time - Time.deltaTime;

        minutes = Mathf.FloorToInt(time / 60);
        seconds = Mathf.FloorToInt(time % 60);

        minutes.ToString();
        seconds.ToString();

        if (time <= 1)
        {
            timer.text = "";
            GameOverScript.endGame();
        }

        if (seconds != 0)
        {
            timer.text = string.Concat(minutes, ":", seconds);
        }
        else
        {
            timer.text = string.Concat(minutes, ":00");
        }
        if (seconds < 10)
        {
            timer.text = string.Concat(minutes, ":0", seconds);
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (life <= 0)
        {
            GameOverScript.endGame();
        }

        float xOffset = 0.0f;

        for (int i = 0; i < hearts.Count; i++)
        {
            Vector3 temp = hearts[i].transform.position;
            temp.y = transform.position.y + 6.5f;
            temp.x = transform.position.x + 6.8f + xOffset;
            hearts[i].transform.position = temp;
            xOffset = xOffset + 0.7f;
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (life <= 0)
        {
            GameOverScript.endGame();
            Time.timeScale = 0;
        }

        float xOffset = 0.0f;

        for (int i = 0; i < hearts.Count; i++)
        {
            Vector3 temp = hearts[i].transform.position;
            temp.y = transform.position.y + 4.31f;
            temp.x = transform.position.x + 5.0f + xOffset;
            hearts[i].transform.position = temp;
            xOffset = xOffset + 0.7f;
        }
    }