private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Item")) { Item hitBy = other.gameObject.GetComponent <Item>(); pController.OnItemCollision(hitBy); } if (other.gameObject.CompareTag("FallingObstacle")) { FallingObstacle hitBy = other.gameObject.GetComponent <FallingObstacle>(); pController.OnFallingObstacleCollision(hitBy); } }
public void OnFallingObstacleCollision(FallingObstacle hitBy) { if (immune) { return; } Vector3 dir = transform.position - hitBy.transform.position; dir.y = 0.0f; pushedCor = StartCoroutine(Pushed(dir.normalized * hitBy.pushForce)); Hurt(hitBy.damage); AkSoundEngine.PostEvent("Weapon_hit", gameObject); StartCoroutine(ImmunityTime()); }