public override void Execute(EventQueue p_eventQueue) { if ( !SourceEntity.MarkedForDestruction && !TargetEntity.MarkedForDestruction && NavigationGraphAlgorithm.areNavigationNodesNeighbors(NavigationGraphContainer.UniqueNavigationGraph, SourceEntity.CurrentNavigationNode, TargetEntity.CurrentNavigationNode, NavigationGraphFlag.SNAPSHOT)) { ActionPoint l_actionPoint = EntityComponent.get_component <ActionPoint>(SourceEntity); if (l_actionPoint.ActionPointData.CurrentActionPoints >= Attack.AttackData.APCost) { ActionPoint.add(EntityComponent.get_component <ActionPoint>(SourceEntity), -1 * Attack.AttackData.APCost); EntityGameWorld.orientTowards(ref SourceEntity.EntityGameWorld, TargetEntity, math.up()); float l_appliedDamage = Attack.resolve(Attack, TargetEntity); EventQueue.insertEventAt(p_eventQueue, 0, EntityApplyDamageEvent.alloc(TargetEntity, l_appliedDamage)); if (Attack.AttackBeforeDamageEventHook != null) { Attack.AttackBeforeDamageEventHook.SourceEntity = SourceEntity; Attack.AttackBeforeDamageEventHook.FeedEventQueue(p_eventQueue, 0); } } } }
public static EntityApplyDamageEvent alloc(Entity p_targetEntity, float p_signedAmountOfDamage) { EntityApplyDamageEvent l_instance = new EntityApplyDamageEvent(); l_instance.TargetEntity = p_targetEntity; l_instance.SignedAmountOfDamage = p_signedAmountOfDamage; return(l_instance); }