private void OnTriggerEnter(Collider other) { // prevent the function being called more than once if (isTouched) { return; } if (other.CompareTag("Player")) { isTouched = true; levelManager.AddScore(10); enemyAnimation.Hit(); } }
//===================================================== private IEnumerator TakingDamage(Action onComplete) { //Debug.Log( "Ouch!" ); // Halt movement _thisAgent.speed = 0.0f; _animation.Hit(true); yield return(new WaitForSeconds(0.25f)); _animation.IdleFidget(); yield return(new WaitForSeconds(4.0f)); // *** Damaged -> GATHERING *** if (onComplete != null) { onComplete(); } }