private Actor getNearestEnemyInAgroRange() { Actor nearestInRange = null; float nearestDist = float.MaxValue; List <Actor> playerAgents = World.getActorProfile().getAllActorsWithFaction(Actor.getFactionHostileTo(character.getFaction())); foreach (Actor test in playerAgents) { float distToTest = Vector3.Distance(test.getFootLocation(), character.getFootLocation()); if (distToTest < nearestDist && distToTest < agroRange) { nearestInRange = test; nearestDist = distToTest; } } return(nearestInRange); }
public override void getHit(float damage, Vector3 hitForceDirection, Actor striker) { recieveDamage(damage); hitForceDirection = applyKnockBack(hitForceDirection); setJobAndCheckUseability(new AttackActorJob(striker, World.getPathingProfile(), World.getActorProfile(), this)); }