예제 #1
0
 // Token: 0x06008D0E RID: 36110 RVA: 0x0029288C File Offset: 0x00290A8C
 public void GetSuccessors(WorldPathfinder pathfinder, WorldPathNode parentNode)
 {
     foreach (int id in this.m_waypointInfo.Waypoints_ID)
     {
         this.AddSuccessor(pathfinder, id, parentNode);
     }
 }
예제 #2
0
        // Token: 0x06008D23 RID: 36131 RVA: 0x00293140 File Offset: 0x00291340
        public bool FindPath(ClientWorld world, int start, int goal, List <int> path, bool checkWaypointStatus)
        {
            this.InitiatePathfind();
            this.m_clientWorld           = world;
            this.m_isCheckWaypointStatus = checkWaypointStatus;
            ConfigDataWaypointInfo waypointInfo;
            Vector2 position;

            if (!this.GetWaypoint(start, out waypointInfo, out position))
            {
                return(false);
            }
            ConfigDataWaypointInfo waypointInfo2;
            Vector2 position2;

            if (!this.GetWaypoint(goal, out waypointInfo2, out position2))
            {
                return(false);
            }
            WorldPathNode worldPathNode = this.AllocatePathNode();

            worldPathNode.m_waypointInfo = waypointInfo;
            worldPathNode.m_position     = position;
            WorldPathNode worldPathNode2 = this.AllocatePathNode();

            worldPathNode2.m_waypointInfo = waypointInfo2;
            worldPathNode2.m_position     = position2;
            this.SetStartAndGoalStates(worldPathNode, worldPathNode2);
            do
            {
                this.SearchStep();
            }while (this.m_State == WorldPathfinder.SearchState.Searching);
            if (this.m_State == WorldPathfinder.SearchState.Succeeded)
            {
                WorldPathNode worldPathNode3 = this.GetSolutionStart();
                path.Add(worldPathNode3.m_waypointInfo.ID);
                for (;;)
                {
                    worldPathNode3 = this.GetSolutionNext();
                    if (worldPathNode3 == null)
                    {
                        break;
                    }
                    path.Add(worldPathNode3.m_waypointInfo.ID);
                }
                this.FreeSolutionNodes();
                return(true);
            }
            return(false);
        }
예제 #3
0
 // Token: 0x06008D17 RID: 36119 RVA: 0x00292BCC File Offset: 0x00290DCC
 public void SetStartAndGoalStates(WorldPathNode start, WorldPathNode goal)
 {
     this.m_Start             = this.AllocateNode();
     this.m_Goal              = this.AllocateNode();
     this.m_Start.m_UserState = start;
     this.m_Goal.m_UserState  = goal;
     this.m_State             = WorldPathfinder.SearchState.Searching;
     this.m_Start.g           = 0f;
     this.m_Start.h           = this.m_Start.m_UserState.GetGoalHeuristic(this);
     this.m_Start.f           = this.m_Start.g + this.m_Start.h;
     this.m_Start.parent      = null;
     this.m_OpenList.AddLast(this.m_Start);
     this.m_Steps = 0;
 }
예제 #4
0
        // Token: 0x06008D0F RID: 36111 RVA: 0x002928F0 File Offset: 0x00290AF0
        private void AddSuccessor(WorldPathfinder pathfinder, int id, WorldPathNode parentNode)
        {
            ConfigDataWaypointInfo configDataWaypointInfo;
            Vector2 position;

            if (!pathfinder.GetWaypoint(id, out configDataWaypointInfo, out position))
            {
                return;
            }
            if (parentNode != null && configDataWaypointInfo == parentNode.m_waypointInfo)
            {
                return;
            }
            if ((!pathfinder.HasGoalNode() || configDataWaypointInfo != pathfinder.GoalNode.m_waypointInfo) && !pathfinder.CanMoveToWaypoint(id))
            {
                return;
            }
            WorldPathNode worldPathNode = pathfinder.AllocatePathNode();

            worldPathNode.m_waypointInfo = configDataWaypointInfo;
            worldPathNode.m_position     = position;
            pathfinder.AddSuccessor(worldPathNode);
        }
예제 #5
0
 // Token: 0x06008D0D RID: 36109 RVA: 0x00292878 File Offset: 0x00290A78
 public float GetCost(WorldPathfinder pathfinder, WorldPathNode successor)
 {
     return(Vector2.Distance(this.m_position, successor.m_position));
 }
예제 #6
0
 // Token: 0x06008D0B RID: 36107 RVA: 0x00292850 File Offset: 0x00290A50
 public bool IsSameState(WorldPathNode rhs)
 {
     return(this.m_waypointInfo == rhs.m_waypointInfo);
 }
예제 #7
0
 // Token: 0x06008D19 RID: 36121 RVA: 0x00292FA4 File Offset: 0x002911A4
 public void AddSuccessor(WorldPathNode state)
 {
     WorldPathfinder.Node node = this.AllocateNode();
     node.m_UserState = state;
     this.m_Successors.Add(node);
 }