public virtual void HitObject()
        {
            healthControllerHit = hit.transform.GetComponentInParent <HealthController>();
            HealthControllerProp propHealthController = healthControllerHit as HealthControllerProp;

            if (healthControllerHit != null && propHealthController == null) //Hit a Player Or AI, WIll not execute any other logic outside of here
            {
                hittableObjectController = hit.collider.GetComponent <HittableObjectController>();
                hittableObjectController.ObjectHit(hit.point, originalFiredPosition);
                SubHitboxController hitboxController = hit.collider.GetComponent <SubHitboxController>();
                healthControllerHit.TakeDamage(damage, hitboxController.hitboxType);
                DestroyProjectile();
                return;
            }
            if (propHealthController != null)
            {
                healthControllerHit.TakeDamage(damage, HitboxType.PROP);
                DestroyProjectile();
            }

            hittableObjectController = hit.transform.GetComponent <HittableObjectController>();
            if (hittableObjectController != null)
            {
                // Debug.Log(3);
                hittableObjectController.ObjectHit(hit.point, -hit.normal);
            }

            AIManager.singleton.SendNotificationToAi(weaponItem.gunshotSoundNotificationDistance, transform.position);

            DestroyProjectile();
        }
예제 #2
0
 public void MakeSureHasEffectController()
 {
     for (int i = 0; i < hitboxColliders.Count; i++)
     {
         if (hitboxColliders[i].gameObject.GetComponent <HittableObjectController>() == null)
         {
             HittableObjectController control = hitboxColliders[i].gameObject.AddComponent <HittableObjectController>();
             control.effectType = HitEffectType.BLOOD;
         }
     }
 }