Pathplanning now ignores grid.
parent
3ebf6d76d8
commit
1ae17ed63b
|
@ -97,7 +97,7 @@ public class NavigationComponent : Node
|
|||
}
|
||||
|
||||
|
||||
public void Plan(Vector3 fromPositionWorld, Vector3 toPositionWorld)
|
||||
public void PlanGridPath(Vector3 fromPositionWorld, Vector3 toPositionWorld)
|
||||
{
|
||||
Vector2 fromPositionOffset = TileWorld.WorldToOffsetCoords(fromPositionWorld);
|
||||
Vector2 toPositionOffset = TileWorld.WorldToOffsetCoords(toPositionWorld);
|
||||
|
@ -134,23 +134,56 @@ public class NavigationComponent : Node
|
|||
}
|
||||
|
||||
|
||||
public void Plan(Vector3 fromPositionWorld, Vector3 toPositionWorld, Quat toWorldOrientation)
|
||||
public void PlanGridPath(Vector3 fromPositionWorld, Vector3 toPositionWorld, Quat toWorldOrientation)
|
||||
{
|
||||
Plan(fromPositionWorld, toPositionWorld);
|
||||
PlanGridPath(fromPositionWorld, toPositionWorld);
|
||||
|
||||
_pathWorldNavigationPoints.Add(new NavigationPoint(toWorldOrientation));
|
||||
}
|
||||
|
||||
|
||||
public void PlanGridPath(Transform fromTransformWorld, NavigationPoint navigationPoint)
|
||||
{
|
||||
if (navigationPoint.Flags.HasFlag(NavigationPoint.NavigationFlags.Position)
|
||||
&& navigationPoint.Flags.HasFlag(NavigationPoint.NavigationFlags.Orientation))
|
||||
{
|
||||
PlanGridPath(fromTransformWorld.origin, navigationPoint.WorldPosition, navigationPoint.WorldOrientation);
|
||||
} else if (navigationPoint.Flags.HasFlag(NavigationPoint.NavigationFlags.Position))
|
||||
{
|
||||
PlanGridPath(fromTransformWorld.origin, navigationPoint.WorldPosition);
|
||||
} else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void PlanDirectPath(Vector3 fromPositionWorld, Vector3 toPositionWorld)
|
||||
{
|
||||
_pathWorldNavigationPoints.Clear();
|
||||
_pathWorldNavigationPoints.Add(new NavigationPoint(toPositionWorld));
|
||||
|
||||
UpdateCurrentGoal();
|
||||
}
|
||||
|
||||
|
||||
public void PlanDirectPath(Vector3 fromPositionWorld, Vector3 toPositionWorld, Quat toWorldOrientation)
|
||||
{
|
||||
PlanDirectPath(fromPositionWorld, toPositionWorld);
|
||||
|
||||
_pathWorldNavigationPoints.Add(new NavigationPoint(toWorldOrientation));
|
||||
}
|
||||
|
||||
|
||||
public void Plan(Transform fromTransformWorld, NavigationPoint navigationPoint)
|
||||
public void PlanDirectPath(Transform fromTransformWorld, NavigationPoint navigationPoint)
|
||||
{
|
||||
if (navigationPoint.Flags.HasFlag(NavigationPoint.NavigationFlags.Position)
|
||||
&& navigationPoint.Flags.HasFlag(NavigationPoint.NavigationFlags.Orientation))
|
||||
{
|
||||
Plan(fromTransformWorld.origin, navigationPoint.WorldPosition, navigationPoint.WorldOrientation);
|
||||
PlanDirectPath(fromTransformWorld.origin, navigationPoint.WorldPosition, navigationPoint.WorldOrientation);
|
||||
} else if (navigationPoint.Flags.HasFlag(NavigationPoint.NavigationFlags.Position))
|
||||
{
|
||||
Plan(fromTransformWorld.origin, navigationPoint.WorldPosition);
|
||||
PlanDirectPath(fromTransformWorld.origin, navigationPoint.WorldPosition);
|
||||
} else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -76,7 +76,7 @@ public class Player : Entity
|
|||
if (currentTask is TaskQueueComponent.NavigationTask)
|
||||
{
|
||||
TaskQueueComponent.NavigationTask navigationTask = (TaskQueueComponent.NavigationTask)currentTask;
|
||||
_navigationComponent.Plan(GlobalTransform, navigationTask.NavigationPoint);
|
||||
_navigationComponent.PlanDirectPath(GlobalTransform, navigationTask.NavigationPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue