Created
August 18, 2015 09:04
-
-
Save Shogan/d6fc2a2ba388f71c5e88 to your computer and use it in GitHub Desktop.
An example method that gets subscribed to the OnLaserHitTriggered event. This is attached to an entity, and when the laser raycast hits the entity, damage is dealt to it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnLaserHitTriggered(RaycastHit2D hitInfo) | |
{ | |
if (hitInfo.collider.gameObject == gameObject) | |
{ | |
if (bloodParticleSystem != null) | |
{ | |
bloodParticleSystem.Play(); | |
HealthPoints --; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment