Exemplo n.º 1
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.transform.tag == "Pickup")
        {
            invulnerable = true;
            gameObject.GetComponent <SpriteRenderer>().color = Color.black;
            coroutine = Wait(pickupTime);
            StartCoroutine(coroutine);
            character.speed = character.speed * 1.5f;
            Destroy(collision.gameObject);
            score.Increment(1);
        }
        else if (collision.transform.tag == "Point")
        {
            Destroy(collision.gameObject);
            score.Increment(0);
        }
        else if (collision.transform.tag == "Enemy")        // enemy
        {
            if (invulnerable)
            {
                score.Increment(2);
                collision.transform.GetComponent <Character>().Kill();
            }
            else
            {             // here is death sequence for player, I'm removing one life and spawning next player before destroying this one
                lives.Die();

                spawn.Spawn();
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        scoreDisplay.text = "" + score.ToString();

        if (score < 0)
        {
            Lives.Die();
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        countdown.text = ("" + timeLeft); //Showing the Score on the Canvas

        if (timeLeft <= 0)
        {
            Time.timeScale = 0.0f;
            timeLeft       = 0; //This makes the timer 0 if it goes to a value less than 0.
            Lives.Die();
        }
    }
 public void OnClick()
 {
     pauseCanvas.SetActive(false);
     Lives.Die();
     Time.timeScale = 1.0f;
 }
Exemplo n.º 5
0
 public void OnTriggerEnter(Collider other)
 {
     Lives.Die();
 }