Ejemplo n.º 1
0
 private IEnumerator AITurn(int playerNum) /// AI Controls
 {
     MessageText.text = "";
     //move or choose wall
     playerStatus[playerNum].currentTurn = true;
     playersTurnText.text = "Player " + (playerNum + 1) + "'s Turn!";
     Assets.Scripts.ActionFunction action = MyAgent.NextMove(MainBoard, playerNum); // <- currently has an issue
     if (action.function == null)
     {
         Debug.LogError("Agent action is null. Something is wrong. Agent just skip his move");
         yield break;
     }
     if (action.function.Method.Name == "MovePawn")
     {
         RenderPawnPosition(action.player, action.x, action.y);
     }
     else if (action.function.Method.Name == "PlaceHorizontalWall")
     {
         RenderWall(action.x, action.y, true);
     }
     else if (action.function.Method.Name == "PlaceVerticalWall")
     {
         RenderWall(action.x, action.y, false);
     }
     else
     {
         Debug.LogError("Agent returning a non-supported action");
     }
     MainBoard.ExecuteFunction(action);
     UpdateWallRemTxt(); //Update UI anyway because it doesn't matter
     yield return(null);
 }