void OnTriggerEnter(Collider other) { if (other.CompareTag("Sword")) { //other.GetComponent<Collider>().enabled = false; zombieHealthController.ApplyDamage(damage); audioSource.PlayOneShot(hitSound, 0.2f); //Vector3 awayFromSwordHitPoint = (transform.position - other.gameObject.transform.position); Vector3 awayFromPlayer = (transform.position - other.GetComponentInParent <Transform>().position); enemyRb.AddForce(awayFromPlayer * 1000f * Time.deltaTime, ForceMode.Impulse); Instantiate(bloodEffect, transform.position + new Vector3(0, 1.7f, 0), Quaternion.identity); if (zombieHealth > damage) { actions.Damaged(); } if (zombieHealth <= damage) { currentState = States.Dead; } StartCoroutine(CalmDown()); } if (other.CompareTag("Arrow")) { damage = GameObject.FindWithTag("Arrow").GetComponent <Weapon>().weaponDamage; zombieHealthController.ApplyDamage(damage); audioSource.PlayOneShot(hitSound, 0.2f); Vector3 awayFromPlayer = (transform.position - other.GetComponentInParent <Transform>().position); enemyRb.AddForce(awayFromPlayer * 1000f * Time.deltaTime, ForceMode.Impulse); Instantiate(bloodEffect, transform.position + new Vector3(0, 1.7f, 0), Quaternion.identity); if (zombieHealth > damage) { actions.Damaged(); } if (zombieHealth <= damage) { currentState = States.Dead; } } }