Skip to content

Instantly share code, notes, and snippets.

@Drenerdo
Created January 18, 2017 09:26
Show Gist options
  • Save Drenerdo/2814d46fa9a9d814e87b50275389bde4 to your computer and use it in GitHub Desktop.
Save Drenerdo/2814d46fa9a9d814e87b50275389bde4 to your computer and use it in GitHub Desktop.
PunchableBodyParts.cs
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Collider))]
public class PunchableBodyParts : MonoBehaviour
{
public EnemyController enemy;
void OnTriggerEnter(Collider col)
{
enemy.curHealth -= 1f;
if (col.gameObject.tag == "Head")
{
Debug.Log (col.gameObject.tag + " Collider works ");
enemy.anim.SetBool ("HeadHit", true);
}
if (col.gameObject.tag == "Spine")
{
Debug.Log (col.gameObject.tag + " Collider works ");
enemy.anim.SetBool ("isHurt", true);
}
if (col.gameObject.tag == "Hips")
{
Debug.Log (col.gameObject.tag + " Collider works ");
enemy.anim.SetBool ("isHurt", true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment