Skip to content

Instantly share code, notes, and snippets.

@Shogan
Created August 18, 2015 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shogan/d6fc2a2ba388f71c5e88 to your computer and use it in GitHub Desktop.
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.
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