コード例 #1
0
 public bool CanWalk(IMoveable <Node> moveable, Vector2Int from, Vector2Int to)
 {
     nodeCache.Clear();
     NavGrid.GetLine(nodeCache, from, to);
     nodeCache.RemoveAt(0);
     nodeCache.RemoveAt(nodeCache.Count - 1);
     return(nodeCache.IsLineWalkable(moveable));
 }
コード例 #2
0
 // Not the perfect place for this function, but did it for the cache. Might make a separate script for this.
 /// <summary>
 /// Used for objects to check if an object can see amother object
 /// </summary>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <returns></returns>
 public bool CanSee(Vector2Int from, Vector2Int to)
 {
     nodeCache.Clear();
     NavGrid.GetLine(nodeCache, from, to);
     nodeCache.RemoveAt(0);
     nodeCache.RemoveAt(nodeCache.Count - 1);
     return(!nodeCache.IsLineInterrupted());
 }