Beispiel #1
0
    public void OnTriggerEnter(Collider coll)
    {
        GameObject other = coll.gameObject.transform.root.gameObject;

        if (other.tag == "Projectile")
        {
            Projectile_Manager p = other.gameObject.GetComponent <Projectile_Manager>();
            p.ParticlesOnDeath();
            health -= p.damageOnHit * damageMultiplier;
            Instantiate(p.effect, gameObject.transform);
            Destroy(other.gameObject);
        }
        if (other.tag == "Waypoint")
        {
            other = coll.gameObject.transform.parent.gameObject;
            nav.SetWaypoint(other.gameObject.GetComponent <Waypoint>().nextWaypoint);
        }
        else if (other.tag == "EndPoint")
        {
            mana.currentMana -= 2 * health;
            textyPoo.AddText("-2" + (2 * health));
            other = coll.gameObject;
            nav.SetWaypoint(nav.firstWaypoint);
            gameObject.transform.position = nav.spawnPos;
        }
        else if (other.tag == "Tower")
        {
            if (!other.GetComponent <Tower_Manager>().beingBlocked)
            {
                StartCoroutine(ApproachTower(other.gameObject));
            }
        }
    }
    public void OnTriggerEnter(Collider coll)
    {
        GameObject other = coll.gameObject.transform.root.gameObject;

        if (other.tag == "Projectile")
        {
            Projectile_Manager p = other.gameObject.GetComponent <Projectile_Manager>();
            p.ParticlesOnDeath();
            health -= p.damageOnHit * damageMultiplier;
            Instantiate(p.effect, gameObject.transform);
            Destroy(other.gameObject);
        }
        else if (other.tag == "Waypoint")
        {
            other = coll.gameObject.transform.parent.gameObject;
            nav.SetWaypoint(other.gameObject.GetComponent <Waypoint>().nextWaypoint);
        }
        else if (other.tag == "EndPoint")
        {
            mana.currentMana -= 2 * health;
            textyPoo.AddText("-2" + (2 * health));
            other = coll.gameObject;
            nav.SetWaypoint(nav.firstWaypoint);
            gameObject.transform.position = nav.spawnPos;
        }
        else if (other.tag == "Tower")
        {
            // don't blow up if tower is already disabled
            if (!other.gameObject.GetComponent <Tower_Manager>().canFire)
            {
                return;
            }
            // decide whether or not to blow up. For our purposes, we will go boom immeadiately
            // also fire off the bomber particle effect
            StartCoroutine("bomberSequence", other.gameObject);
        }
    }