private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Projectile") { TakeDamage(10); LaserBoltController laserBolt = other.gameObject.GetComponentInParent <LaserBoltController>(); if (laserBolt) { laserBolt.Explode(); } } }
void OnTriggerEnter(Collider other) { if (mIsOn) { if (other.tag == "Projectile") { LaserBoltController laserBolt = other.gameObject.GetComponentInParent <LaserBoltController>(); laserBolt.Reflect(); mAudioSource.PlayOneShot(BladeReflectSound); } Destroyable destroyable = other.gameObject.GetComponent <Destroyable>(); if (destroyable) { destroyable.Destroyed(); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Projectile") { //Explode(); LaserBoltController laserBolt = other.gameObject.GetComponentInParent <LaserBoltController>(); if (laserBolt) { laserBolt.Explode(); } } else if (other.gameObject.tag == "Player") { Explode(); BodyController controller = other.gameObject.GetComponent <BodyController>(); if (controller) { controller.TakeDamage(10); } } }