-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,40 @@ a path find for tilebase game in unity | |
|
||
## How to use | ||
|
||
### Extend base engine | ||
|
||
before you use `CEPathFind`, you shoud provide an pathfind engine with overrde this class `CEPathFindBasic.cs` | ||
|
||
|
||
```csharp | ||
|
||
//Get an tile property | ||
//you can check A start path find wiki for more info about score. | ||
override public void GetTileProperty (int _tileX, int _tileY, | ||
CEPathFindNode _star, CEPathFindNode _end, | ||
out bool _isWalkable, out int _score) | ||
{ | ||
_isWalkable = true; | ||
_score = 1; | ||
} | ||
|
||
|
||
override public bool isTileWalkable (int _tileX, int _tileY) | ||
{ | ||
return true; | ||
} | ||
|
||
|
||
override public TILE_SERACH_TYPE GetTileSerachType () | ||
{ | ||
return TILE_SERACH_TYPE.EIGHT_DIRECTION_FIX_CORNER; | ||
} | ||
|
||
``` | ||
|
||
|
||
### Call pathfind | ||
|
||
there is two way to use it. | ||
|
||
- Immediate return | ||
|
@@ -43,4 +77,24 @@ private const int EACH_TICK_SEARCH_NODE_NUM = 50; | |
``` | ||
|
||
|
||
--- | ||
## PathFindType | ||
|
||
### 4 direction | ||
![img1](md/img3.jpg) | ||
|
||
### 8 direction | ||
![img1](md/img2.jpg) | ||
|
||
### 8 direction with fix corner | ||
![img1](md/img1.jpg) | ||
|
||
|
||
## Issue | ||
|
||
e-mail: [email protected] | ||
|
||
|
||
thanks. | ||
Eran | ||
|