示例#1
0
        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;
                    }
                }
            }
        }
示例#2
0
 void Awake()
 {
     nodeGrid           = GetComponent <NodeGrid2D> ();
     pathReqeustManager = GetComponent <PathRequestManager> ();
 }