Example #1
0
    public void Lose()
    {
        int score = (int)ScoreBar.GetInstance().score;

        scoreField.GetComponent <Text>().text = "Score: " + score;
        ScoreBar.GetInstance().SetVisible(false);
        canvas.enabled = true;
    }
Example #2
0
    private void Update()
    {
        ScoreBar.GetInstance().SetLives(lives);
        Rect cameraRect = CameraMovement.CameraRect();

        if ((transform.position.y < cameraRect.yMin || transform.position.x < cameraRect.xMin) && state == State.ALIVE)
        {
            Die();
        }
    }
Example #3
0
    private void Die()
    {
        if (pm.Grounded())
        {
            return;
        }

        lives--;
        ScoreBar.GetInstance().SetLives(lives);
        if (lives == 0)
        {
            //lose
            state        = State.DEAD;
            c2d.enabled  = false;
            cp2d.enabled = false;
            GameOver.GetInstance().Lose();
        }
        else
        {
            //respawn
            StartCoroutine(Respawn());
        }
    }
    IEnumerator RunClimateEvent(string name, float time)
    {
        SetClimateEvent(name);
        foreach (GameObject go in Director.GetInstance().GetPlatforms())
        {
            if (go != null)
            {
                go.GetComponent <Platform>().UpdateClimateEvents();
            }
        }
        yield return(new WaitForSeconds(time));

        SetClimateEvent("None");
        foreach (GameObject go in Director.GetInstance().GetPlatforms())
        {
            if (go != null)
            {
                go.GetComponent <Platform>().UpdateClimateEvents();
            }
        }
        ScoreBar.GetInstance().Reset();
        current = null;
    }