示例#1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerProjectile")
        {
            SpawnExplosionParticles();

            SpawnPickup();

            PlayerShipCtrl.ModScore(pointValue);

            StartDestroy(shipDestroySfx.length);

            GetComponent <AudioSource>().PlayOneShot(shipDestroySfx);
        }
        else if (other.tag == "PlayerShip")
        {
            SpawnExplosionParticles();

            PlayerShipCtrl.ModScore(-1);

            PlayerShipCtrl.ModShield(-1);

            StartDestroy(shipDestroySfx.length);

            GetComponent <AudioSource>().PlayOneShot(shipDestroySfx);
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerProjectile")
        {
            ModShield(-1);
        }
        else if (other.tag == "PlayerShip")
        {
            Destroy(gameObject);

            PlayerShipCtrl.ModScore(-1);

            PlayerShipCtrl.ModShield(-1);
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerShip")
        {
            Debug.Log("Hit a Player!");

            Destroy(gameObject, 2.0f);

            //audio
            StartDestroy(shotSfxClip.length);

            ParentShip.ModScore(-1);

            ParentShip.ModShield(-1);

            SpawnHitParticles();
        }
    }