Interface IRouteWalker
Interface that makes an entity walks along a given path
Properties
CurrentDirection
Which direction this entity is currently walking
Declaration
Direction8 CurrentDirection { get; set; }
TargetPosition
Where does this entity currently walking
Declaration
Int2 TargetPosition { get; set; }
Methods
GetNextRoutePosition(Entity, ref Direction8, ref Int2, int, int, bool, BlockType, bool, HashSet<int>)
Get the position in global space that the walker entity should go to
Declaration
public static Int2 GetNextRoutePosition(Entity entity, ref Direction8 currentDirection, ref Int2 targetPosition, int pathID, int speed, bool allowTurnBack = false, BlockType pathType = BlockType.Element, bool allowTilt = true, HashSet<int> pathSet = null)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | Target entity that walks |
Direction8 | currentDirection | Which direction this entity is currently walking |
Int2 | targetPosition | Where does this entity currently walking |
int | pathID | Which map block should be treat as the path marker |
int | speed | Movement speed in global space |
bool | allowTurnBack | True if the walker turn back when reach the edge |
BlockType | pathType | Block type of the path marker |
bool | allowTilt | True if the walker can walk diagonally |
HashSet<int> | pathSet | A hash set of path marks, set to null if there's only one mark |
Returns
Type | Description |
---|---|
Int2 | The final position in global space |
GetNextRoutePosition(IRouteWalker, int, int, bool, BlockType, bool, HashSet<int>)
Get the position in global space that the walker entity should go to
Declaration
public static Int2 GetNextRoutePosition(IRouteWalker walker, int pathID, int speed, bool allowTurnBack = false, BlockType pathType = BlockType.Element, bool allowTilt = true, HashSet<int> pathSet = null)
Parameters
Type | Name | Description |
---|---|---|
IRouteWalker | walker | Target walker |
int | pathID | Which map block should be treat as the path marker |
int | speed | Movement speed in global space |
bool | allowTurnBack | True if the walker turn back when reach the edge |
BlockType | pathType | Block type of the path marker |
bool | allowTilt | True if the walker can walk diagonally |
HashSet<int> | pathSet | A hash set of path marks, set to null if there's only one mark |
Returns
Type | Description |
---|---|
Int2 | The final position in global space |
TryGetRouteFromMap(HashSet<int>, int, int, Direction8, out Direction8, BlockType, bool)
Get path marker block from map
Declaration
public static bool TryGetRouteFromMap(HashSet<int> pathSet, int unitX, int unitY, Direction8 currentDirection, out Direction8 result, BlockType pathType = BlockType.Element, bool allowTilt = true)
Parameters
Type | Name | Description |
---|---|---|
HashSet<int> | pathSet | A hash set of path marks, set to null if there's only one mark |
int | unitX | Position X in unit space |
int | unitY | Position Y in unit space |
Direction8 | currentDirection | Which direction this entity is currently walking |
Direction8 | result | Direction the walker should go |
BlockType | pathType | Block type of the path marker |
bool | allowTilt | True if the walker can walk diagonally |
Returns
Type | Description |
---|---|
bool | True if the path is successfuly found |
TryGetRouteFromMap(int, int, int, Direction8, out Direction8, BlockType, bool)
Get path marker block from map
Declaration
public static bool TryGetRouteFromMap(int pathID, int unitX, int unitY, Direction8 currentDirection, out Direction8 result, BlockType pathType = BlockType.Element, bool allowTilt = true)
Parameters
Type | Name | Description |
---|---|---|
int | pathID | ID of the path marker block |
int | unitX | Position X in unit space |
int | unitY | Position Y in unit space |
Direction8 | currentDirection | Which direction this entity is currently walking |
Direction8 | result | Direction the walker should go |
BlockType | pathType | Block type of the path marker |
bool | allowTilt | True if the walker can walk diagonally |
Returns
Type | Description |
---|---|
bool | True if the path is successfuly found |