Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
PathManager Class Reference
Inheritance diagram for PathManager:

Public Types

enum  MoveType { Default , Combat }
 

Public Member Functions

void RequestPath (PathProgress progress)
 
void RequestPathImmediate (PathProgress progress)
 
bool IsPathClear (Point origin, Point dest, IPathfindWalker walker, int radius)
 
PathProgress RequestPathImmediate (Point origin, Point dest, IPathfindWalker walker, MoveType moveType=MoveType.Default, int searchLimit=-1, int destDist=0)
 
Point GetFirstStep (Point origin, Point _dest, IPathfindWalker walker, int maxDist=20, MoveType moveType=MoveType.Default)
 
Point _GetFirstStep (Point origin, Point dest, IPathfindWalker walker, int maxDist=20, MoveType moveType=MoveType.Default)
 
void OnGridModified ()
 

Public Attributes

PathFinder _pathfinder
 
int searchLimit = 1000000
 

Static Public Attributes

static int requestCount
 
static PathManager Instance
 
static PathProgress tempProgress = new PathProgress()
 

Properties

IPathfinder pathfinder [get]
 

Private Member Functions

void Awake ()
 

Detailed Description

Definition at line 6 of file PathManager.cs.

Member Enumeration Documentation

◆ MoveType

Enumerator
Default 
Combat 

Definition at line 8 of file PathManager.cs.

Member Function Documentation

◆ _GetFirstStep()

Point PathManager._GetFirstStep ( Point  origin,
Point  dest,
IPathfindWalker  walker,
int  maxDist = 20,
MoveType  moveType = MoveType::Default 
)
inline

Definition at line 78 of file PathManager.cs.

79 {
80 if (!dest.IsValid || (dest.cell.blocked && origin.Distance(dest) <= 1))
81 {
82 return Point.Invalid;
83 }
84 tempProgress.walker = walker;
85 tempProgress.moveType = moveType;
86 tempProgress.RequestPathImmediate(origin, dest, (moveType == MoveType.Combat) ? 1 : 0, _ignoreConnection: false, maxDist);
88 {
89 return Point.Invalid;
90 }
91 List<PathFinderNode> nodes = tempProgress.nodes;
92 if (nodes.Count > 0)
93 {
94 PathFinderNode pathFinderNode = nodes[nodes.Count - 1];
95 if (pathFinderNode.X == origin.x && pathFinderNode.Z == origin.z && nodes.Count > 1)
96 {
97 pathFinderNode = nodes[nodes.Count - 2];
98 }
99 if (Mathf.Abs(pathFinderNode.X - origin.x) > 1 || Mathf.Abs(pathFinderNode.Z - origin.z) > 1)
100 {
101 return Point.Invalid;
102 }
103 Point point = new Point(pathFinderNode.X, pathFinderNode.Z);
104 if (point.x == origin.x && point.z == origin.z)
105 {
106 return Point.Invalid;
107 }
108 return point;
109 }
110 return Point.Invalid;
111 }
static PathProgress tempProgress
Definition: PathManager.cs:18
List< PathFinderNode > nodes
Definition: PathProgress.cs:16
void RequestPathImmediate(Point _startPoint, Point _destPoint, int _destDist, bool _ignoreConnection, int _searchLimit=-1)
Definition: PathProgress.cs:61
Definition: Point.cs:9
static Point Invalid
Definition: Point.cs:28
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool IsValid
Definition: Point.cs:88
int Distance(Point p)
Definition: Point.cs:953
Cell cell
Definition: Point.cs:51

References Algorithms.WeightCell.blocked, Point.cell, Point.Distance(), PathProgress.HasPath, Point.Invalid, Point.IsValid, PathProgress.nodes, PathProgress.RequestPathImmediate(), tempProgress, Algorithms.PathFinderNode.X, Point.x, Algorithms.PathFinderNode.Z, and Point.z.

Referenced by GetFirstStep().

◆ Awake()

void PathManager.Awake ( )
inlineprivate

Definition at line 26 of file PathManager.cs.

27 {
28 Instance = this;
29 }
static PathManager Instance
Definition: PathManager.cs:16

References Instance.

◆ GetFirstStep()

Point PathManager.GetFirstStep ( Point  origin,
Point  _dest,
IPathfindWalker  walker,
int  maxDist = 20,
MoveType  moveType = MoveType::Default 
)
inline

Definition at line 67 of file PathManager.cs.

68 {
69 Point dest = _dest.Copy();
70 Point point = _GetFirstStep(origin, dest, walker, maxDist, moveType);
71 if (point.IsValid)
72 {
73 return point;
74 }
75 return Point.Invalid;
76 }
Point _GetFirstStep(Point origin, Point dest, IPathfindWalker walker, int maxDist=20, MoveType moveType=MoveType.Default)
Definition: PathManager.cs:78
Point Copy()
Definition: Point.cs:467

References _GetFirstStep(), Point.Copy(), Point.Invalid, and Point.IsValid.

Referenced by Chara.GetFirstStep().

◆ IsPathClear()

bool PathManager.IsPathClear ( Point  origin,
Point  dest,
IPathfindWalker  walker,
int  radius 
)
inline

Definition at line 47 of file PathManager.cs.

48 {
49 tempProgress.walker = walker;
50 tempProgress.moveType = MoveType.Default;
51 tempProgress.RequestPathImmediate(origin, dest, 0, _ignoreConnection: false);
52 if (tempProgress.nodes.Count > 0)
53 {
54 return tempProgress.nodes.Count < radius;
55 }
56 return false;
57 }

References PathProgress.nodes, PathProgress.RequestPathImmediate(), and tempProgress.

Referenced by Zone.AddGlobalCharasOnActivate().

◆ OnGridModified()

void PathManager.OnGridModified ( )
inline

Definition at line 113 of file PathManager.cs.

114 {
115 }

◆ RequestPath()

void PathManager.RequestPath ( PathProgress  progress)
inline

Definition at line 31 of file PathManager.cs.

32 {
34 progress.state = PathProgress.State.Searching;
35 ThreadPool.QueueUserWorkItem(delegate
36 {
37 new PathThread().Start(progress);
38 });
39 }
static int requestCount
Definition: PathManager.cs:14
void Start(PathProgress progress)
Definition: PathThread.cs:3

References requestCount, and PathThread.Start().

Referenced by PathProgress.RequestPath().

◆ RequestPathImmediate() [1/2]

void PathManager.RequestPathImmediate ( PathProgress  progress)
inline

◆ RequestPathImmediate() [2/2]

PathProgress PathManager.RequestPathImmediate ( Point  origin,
Point  dest,
IPathfindWalker  walker,
MoveType  moveType = MoveType::Default,
int  searchLimit = -1,
int  destDist = 0 
)
inline

Definition at line 59 of file PathManager.cs.

60 {
61 tempProgress.walker = walker;
62 tempProgress.moveType = moveType;
63 tempProgress.RequestPathImmediate(origin, dest, destDist, _ignoreConnection: false, searchLimit);
64 return tempProgress;
65 }
int searchLimit
Definition: PathManager.cs:22

References PathProgress.RequestPathImmediate(), searchLimit, and tempProgress.

Member Data Documentation

◆ _pathfinder

PathFinder PathManager._pathfinder

Definition at line 20 of file PathManager.cs.

Referenced by WidgetDebug.UpdateText().

◆ Instance

◆ requestCount

int PathManager.requestCount
static

Definition at line 14 of file PathManager.cs.

Referenced by RequestPath(), RequestPathImmediate(), and WidgetDebug.UpdateText().

◆ searchLimit

int PathManager.searchLimit = 1000000

◆ tempProgress

PathProgress PathManager.tempProgress = new PathProgress()
static

Definition at line 18 of file PathManager.cs.

Referenced by _GetFirstStep(), IsPathClear(), and RequestPathImmediate().

Property Documentation

◆ pathfinder

IPathfinder PathManager.pathfinder
get

The documentation for this class was generated from the following file: