public void DoDamageAnimationEvent(AnimationEvent animationEvent) { AIAttackInfo attackInfo = animationEvent.objectReferenceParameter as AIAttackInfo; DamageInfo damageInfo = new DamageInfo(attackInfo); damageInfo.sender = gameObject; List <Damageable> damageableList = AttackRaycast(attackInfo); SendDamageEvent(damageableList, damageInfo); }
private List <Damageable> AttackRaycast(AIAttackInfo attackInfo) { RaycastHit[] hitArray = Physics.RaycastAll(AttackRay, attackInfo.range, hitLayer.value, QueryTriggerInteraction.Ignore); if (attackInfo.multipleTargets) { return(HandleMultipleTargetsRaycast(hitArray)); } else { return(HandleSingleTargetRaycast(hitArray)); } }