Created
January 18, 2017 09:26
-
-
Save Drenerdo/2814d46fa9a9d814e87b50275389bde4 to your computer and use it in GitHub Desktop.
PunchableBodyParts.cs
This file contains hidden or 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
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