public virtual bool Movement()
{
//Set the target location for the Target Movement class..
cMovement.CurrentTargetLocation = Cache.CurrentTarget.Position;
//Instead of using target position we use the navigator pathing as CurrentTargetLocation
if (ObjectCache.CheckFlag(Cache.CurrentTarget.targetType.Value, TargetType.LineOfSight | TargetType.Backtrack))
{
//Navigation.NP.MoveTo(FunkyGame.Navigation.LOSmovementObject.Position, "02 LOS:" + FunkyGame.Navigation.LOSmovementObject.InternalName, true);
if (Navigation.Navigation.NP.CurrentPath.Count > 0)
{
//No more points to navigate..
if (Navigation.Navigation.NP.CurrentPath.Count == 1 && FunkyGame.Hero.Position.Distance(Navigation.Navigation.NP.CurrentPath.Current) <= Cache.CurrentTarget.Radius)
{
Helpers.Logger.Write(LogLevel.LineOfSight, "Ending Line of Sight Movement");
if (Cache.CurrentTarget.targetType.Value == TargetType.LineOfSight)
{
FunkyGame.Navigation.LOSmovementObject = null;
}
else
{
//Ending backtracking behavior!
Cache.Backtracking = false;
Cache.StartingLocation = Vector3.Zero;
}
}
else
{
//Skip to next location if within 2.5f distance!
if (Navigation.Navigation.NP.CurrentPath.Count > 1 && FunkyGame.Hero.Position.Distance2D(Navigation.Navigation.NP.CurrentPath.Current) <= 5f)
{
Helpers.Logger.DBLog.Debug("LOS: Skipping to next vector");
Navigation.Navigation.NP.CurrentPath.Next();
}
cMovement.CurrentTargetLocation = Navigation.Navigation.NP.CurrentPath.Current;
}
CurrentState = cMovement.TargetMoveTo(Cache.CurrentTarget);
return false;
}
}
//Check if we are in range for interaction..
if (Cache.CurrentTarget.WithinInteractionRange()) return true;
//Movement required..
CurrentState = cMovement.TargetMoveTo(Cache.CurrentTarget);
return false;
}