public void Initialize() { GetPath(true); grid = NodeGridManager.GetGrid(resolution); PlayAnim(AnimationType.Walk); if (toScreen) { var getNodeTries = 0; Target = OppositeSideOfScreenLoc(); Node targetNode = grid.NodeFromWorldPoint(Target); while (!targetNode.walkable) { Target = OppositeSideOfScreenLoc(); targetNode = grid.NodeFromWorldPoint(Target); getNodeTries++; if (getNodeTries > 20) { break; } } } }
void Awake() { nodeGrid = GetComponent <NodeGrid2D> (); pathReqeustManager = GetComponent <PathRequestManager> (); }