public override void Damaging() { anim.SetTrigger(hitTrigger); //audioSource.Play (); isShocked = true; if (!enemySonar.playerDetected) { enemySonar.StopSearching(); } Invoke("ResetShocked", shockedTime); }
void OnTriggerStay(Collider other) { if (enemyHealth.health > 0) { if (other.CompareTag("Player") && playerHealth.health > 0) { if (readyToHit) { readyToHit = false; //sollte der Spieler in den Enemy laufen bevor dieser vom Enemy entdeckt wurde. if (!enemySonar.playerDetected) { enemySonar.StopSearching(); } other.gameObject.SendMessage( "ApplyDamage", damageValue, SendMessageOptions.DontRequireReceiver); StartCoroutine("SetReadyToHit"); } } } }