using System.Collections; using System.Collections.Generic; using UnityEngine; public class HumanFight : MonoBehaviour { public GameObject goHuman; Animator aniHuman; public int HitCount = 0; // Use this for initialization void Start () { aniHuman = goHuman.GetComponent(); } // Update is called once per frame void Update () { aniHuman.SetInteger("HitCount", HitCount); } void OnTriggerEnter(Collider other) { if (other.tag == "Bullet") { Debug.Log(other.tag); if(HitCount<2) HitCount++; } } }