AI Testing Simulator
|
This class handles the path system for an adversary in a game. It manages waypoints, line renderers, and interaction with the adversary view controller. More...
Public Member Functions | |
bool | IsIgnoringWaypoints () |
Determines if newly placed Waypoints whould ignore Waypoints based on wether the AdversaryController ignores waypoints. | |
bool | IsBuilding () |
Checks if the path is currently in building mode. | |
void | Select (bool forward=false) |
Selects the path and enables building mode. | |
void | AdjustHeights (bool selected) |
Adjusts the heights of the path and waypoints based on the selected state. | |
void | Deselect (bool forward=false) |
Deselects the path and disables building mode. | |
void | Destroy () |
Destroys the path and its associated waypoints. | |
void | Init (AdversaryViewController controller, Color color, Path path, bool building) |
Initializes the path controller with the specified parameters. | |
Location | FindMouseTarget (Vector2 mousePosition) |
void | Update () |
Updates the preview renderer without changing the model. Displays preview based on different collision types and building state. Does not change the Path model in any way. | |
void | AddMoveToWaypoint (Vector2 position, Waypoint waypoint=null, bool addLaneChanges=true) |
Adds a waypoint to the end of the path, either generated or passed as an argument. Keeps waypointViewControllers and pathRenderer in sync. | |
int | AddLaneChangeWaypoints (List< int > laneChanges, List< Vector2 > path, LinkedListNode<(WaypointViewController, int)>? node=null) |
Adds secondary waypoints for lane changes to the Path and waypointViewControllers. Inserts the generated waypoint and waypointViewController after the specified node, or at the end of both containers if no node is provided. | |
void | UpdateAdjacentPaths (WaypointViewController waypointController) |
void | MoveWaypoint (WaypointViewController waypointController, float x, float y) |
Moves the specified waypoint to the new x and y coordinates, updating the path and secondary waypoints as needed. | |
void | RemoveWaypoint (WaypointViewController controller, bool restorePath=true) |
Removes a waypoint from the path and optionally restores the path between the previous and next waypoints. | |
void | AfterEdit () |
Updates the adversary rotation and edge collider after a path edit. | |
void | MoveFirstWaypoint (float x, float y) |
Moves the first waypoint to the specified x and y coordinates. | |
void | SetColor (Color color) |
Sets the color of the path, preview, and waypoints. | |
void | OnMouseDown () |
Handles mouse down events on the path, allowing the user to interact with the waypoints and path. | |
WaypointViewController | GetFirstWaypointController () |
Returns the WaypointViewController for the first waypoint in the path. | |
Public Attributes | |
GameObject | waypointPrefab |
Properties | |
AdversaryViewController | AdversaryViewController [get] |
Path | Path [get, set] |
This class handles the path system for an adversary in a game. It manages waypoints, line renderers, and interaction with the adversary view controller.
|
inline |
Adds secondary waypoints for lane changes to the Path and waypointViewControllers. Inserts the generated waypoint and waypointViewController after the specified node, or at the end of both containers if no node is provided.
laneChanges | A list of integers representing lane change positions. |
path | A list of Vector2 points representing the path. |
node | An optional LinkedListNode containing a tuple of WaypointViewController and an integer, used to insert the new waypoint after this node. Default is null. |
|
inline |
Adds a waypoint to the end of the path, either generated or passed as an argument. Keeps waypointViewControllers and pathRenderer in sync.
position | The position to add the waypoint as a Vector2. |
waypoint | An optional Waypoint object to be added to the path. |
addLaneChanges | A boolean flag to indicate whether to add lane changes or not. Defaults to true. |
|
inline |
Adjusts the heights of the path and waypoints based on the selected state.
selected | True if heights should be adjusted, false otherwise. |
|
inline |
Deselects the path and disables building mode.
forward | If true, calls the deselect method on the adversary view controller. Default is false.</param |
|
inline |
Returns the WaypointViewController for the first waypoint in the path.
|
inline |
Initializes the path controller with the specified parameters.
controller | The adversary view controller associated with this path. |
color | The color for the path. |
path | The Path for this controller. |
building | Optional parameter to set the initial building state. Default is true. |
summary> Target of a click is either a waypoint or the mouse position itself, if waypoints are ignored /summary> param name="mousePosition">The position of the mouse in the game world
returns>A Location object representing the target of the click
|
inline |
Checks if the path is currently in building mode.
|
inline |
Determines if newly placed Waypoints whould ignore Waypoints based on wether the AdversaryController ignores waypoints.
|
inline |
Moves the first waypoint to the specified x and y coordinates.
x | The x coordinate of the new location. |
y | The y coordinate of the new location. |
|
inline |
Moves the specified waypoint to the new x and y coordinates, updating the path and secondary waypoints as needed.
waypointController | The WaypointViewController instance to be moved. |
x | The new x-coordinate of the waypoint. |
y | The new y-coordinate of the waypoint. |
|
inline |
Removes a waypoint from the path and optionally restores the path between the previous and next waypoints.
controller | The WaypointViewController associated with the waypoint to remove. |
restorePath | Whether to restore the path between the previous and next waypoints after removing the waypoint. Default is true. |
|
inline |
Selects the path and enables building mode.
forward | If true, calls the select method on the adversary view controller. Default is false. |
|
inline |
Sets the color of the path, preview, and waypoints.
color | The Color to set for the path, preview, and waypoints. |