public void MakeAMove(int x, int y) { if (gameState.board [x, y] != 0) { return; } availableMoves++; GameState tempGameState = new GameState(gameState); tempGameState.MakeAMove(x, y); switch (tempGameState.winner) { case 0: case 2: AITree newTree = new AITree(tempGameState); if (newTree.goodMove) { moves [x, y] = newTree; } else if (gameState.turnOfPlayer == 1) { moves = null; goodMove = false; } break; case 1: moves = null; goodMove = false; break; } }
public void Restart() { gameState = new GameState(3, 3); if (tile == null) { GenerateTiles(); } for (int x = 0; x < gameState.sizeX; x++) { for (int y = 0; y < gameState.sizeY; y++) { SetColor(x, y); } } int player = Random.Range(1, 3); gameState.turnOfPlayer = player; if (player == 1) { tempTree = refTree1; } else { tempTree = refTree2; } RunAI(); }
//[SerializeField] //private float timer = 0; // Use this for initialization new void Start() { testTree = new AITree(new BTSequence(new List <BTTask>() { new MoveTo(), new Idle() })); if (testTree.Blackboard == null) { Debug.Log("blackboard not setup"); } testTree.Blackboard.SetValue("patrolPoints", targetPositions); testTree.Blackboard.SetValue("owner", gameObject); testTree.BeginTree(); }
// Use this for initialization void Start() { instance = this; GameState gs1 = new GameState(3, 3); gs1.turnOfPlayer = 1; refTree1 = new AITree(gs1); GameState gs2 = new GameState(3, 3); gs2.turnOfPlayer = 2; refTree2 = new AITree(gs2); Restart(); }
public void MakeAMove(int moveX, int moveY) { if (gameState.winner > 0) { return; } gameState.MakeAMove(moveX, moveY); SetColor(moveX, moveY); if (tempTree != null && tempTree.moves != null) { tempTree = tempTree.moves [moveX, moveY]; } if (gameState.winner > 0) { Debug.Log(gameState.winner); } RunAI(); }
private void ChooseBaseStrategy() { aiTree = AITreeDefend.inst; }
private void ChooseBaseStrategy() { aiTree = AITree.GetInstance(); }
public AINode <bool> lastNode; //current node comes from which node. PS: some node need to know last node to decide how to do, such as CloseToNearestEnemy ChooseSkill etc. /// <summary> /// satisfy enter condition or not /// need complete later on /// </summary> public virtual bool Enter(AITree _aiTree) { aiTree = _aiTree; return(true); }