コード例 #1
0
        /// <summary>
        /// Remakes our path if the farmer has changed tiles since the last time
        /// this function was called. (Every quarter second as of right now)
        /// </summary>
        protected virtual void PathfindingRemakeCheck()
        {
            Vector2 leaderCurrentTile = leader.getTileLocation();

            if (targetLastTile != leaderCurrentTile)
            {
                path = aStar.Pathfind(me.getTileLocation(), leaderCurrentTile);
                //if (me.getTileLocation() != currentPathNode)
                //    currentPathNode = path != null && path.Count != 0 ? path.Dequeue() : negativeOne;
                if (path != null && path.Count != 0 && me.getTileLocation() != path.Peek())
                {
                    currentPathNode = path.Dequeue();
                }
                else
                {
                    currentPathNode = negativeOne;
                }
            }

            targetLastTile = leaderCurrentTile;
        }