Example #1
0
    void OnTriggerEnter(Collider other)
    {
        if (respawnProtection >= 0)
        {
            return;
        }

        if (other.gameObject.name.StartsWith("Bullet") &&
            other.gameObject.GetComponent <BulletScript>().mainPlane != this.gameObject)
        {
            Plane1 script = other.gameObject.GetComponent <BulletScript>().mainPlane.GetComponent <Plane1>();
            print(script.targetPlane.name + gameObject.name);
            if (GameController.gamemode == GameController.MODE_TARGETS &&
                script.targetPlane != gameObject)
            {
                return;
            }

            script.famePoints += 100;
            Destroy(other.gameObject);
            soundScript.TauntsFunction(script.id);

            if (alive)
            {
                Death();
                RandomTarget();
                script.RandomTarget();
            }
        }
        else if (other.gameObject.name.StartsWith("Plane"))
        {
            Death();
            famePoints -= 25;
            soundScript.ExplosionFunction();
        }
    }