更新方法不会调用代理的移动

时间:2017-05-17 01:22:09

标签: unity3d unity5

我正在创建一个代理人来玩游戏。我使用A *算法来确定代理应该采用的路径,并将这些网格位置转换为移动。现在我试图让代理在更新功能中执行这些移动,但代理只是徘徊

void Update ()
{    
    if (currentState == AIStates.Idle) 
    {
       runSearch ();                
    }
    if (currentState == AIStates.FollowingPath) 
    {
        if (move_index < this.MovesList.Count) 
        {
                if (currentMove == Player.Moves.Null) 
                {
                    currentMove = MovesList [move_index];
                    ExecuteMove (currentMove);    
                }
        }
        //is_followingpath = true;
    }
    if (currentState == AIStates.PathCompleted) 
    {
        currentState = AIStates.FollowingPath;
    }    
}

所以我在我的更新方法中有类似的东西,我的移动列表只是一个包含MoveLeft,MoveRight等移动的列表,我希望代理执行这些移动......但是代理仍然存在...所有方法已经过测试,它们只是导致问题的更新方法。

0 个答案:

没有答案