Example #1
0
        public bool MoveToPoint(PathNode node)
        {
            if (node.isNew || !node.isDead)
            {
                return(false);
            }
            PathDir dir = new PathDir();

            for (int i = 0; i < node.paths.Length; i++)
            {
                if (node.paths[i] != null)
                {
                    dir.Rotate((PathType)i);
                    break;
                }
            }
            dir.Rotate(PathType.Back);
            LastPathDir = dir;
            lastNode    = node;
            return(true);
        }
Example #2
0
        public bool setTargetPoint(PathNode node)
        {
            TargetDirList.Clear();
            if (lastNode == null)
            {
                return(false);
            }
            if (node.isNew || !node.isDead)
            {
                return(false);
            }
            if (lastNode == node)
            {
                return(false);
            }
            TargetPath = lastNode.gotoNode(node);
            if (TargetPath == null)
            {
                return(false);
            }
            PathDir  dir = LastPathDir;
            PathNode nt  = null;

            foreach (PathNode n in TargetPath)
            {
                PathType type;
                if (nt == null)
                {
                    nt = n;
                    continue;
                }
                type = dir.getDir(nt[n]);
                dir.Rotate(type);
                TargetDirList.Add(type);
                nt = n;
            }
            return(true);
        }