Example #1
0
 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);
     }
 }
Example #2
0
    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());
    }