private void Pursue() { if (Target != null && Target.Position != null) { if(PursuitType == PursuitTypes.CrowFlies || !Pather.HasPath()) // we might have switched bak to path but not have a path yet, don't want to stutter { Owner.RotationTowardFacingDirectionRadians = DrawingUtility.Vector2ToRadian(Target.Position - Owner.Position); Owner.InputMovementVector = Target.Position - Owner.Position; if ((Target.Position - Owner.Position).Length() >= HotPursuitDistance) { Pather.RequestPath(); PursuitType = PursuitTypes.Pathing; } } } }
private void DeterminePursuitType() { if (Target != null && Target.Position != null) { if ((Target.Position - Owner.Position).Length() < HotPursuitDistance) // in range for follow { if (Pather != null) { Pather.ReleasePath(); } PursuitType = PursuitTypes.CrowFlies; } else //out of range, need path again { if (!Pather.HasPath()) { Pather.RequestPath(); } } } }