Beispiel #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        Mover block = other.gameObject.GetComponent <Mover>();

        if (block != null && block.team_id != id)
        {
            health      -= 1;
            hp_text.text = health.ToString();
            if (health <= 0)
            {
                StartCoroutine(restarter.EndAndRestart(end_text, 5));
            }
            else if (health < starting_health / 3)
            {
                hp_text.color = new Color(1f, 0.4f, 0.4f);
            }
            Destroy(other.gameObject);
        }
    }