예제 #1
0
 private void PushTurnHandler(WorldScreen Game)
 {
     switch (PlayerTypes[CurrentTurn])
     {
         case PlayerType.Player:
             Game.PushInputState(new PlayerTurn(CurrentTurn));
             break;
         case PlayerType.AI:
             Game.PushInputState(new AIThink(CurrentTurn));
             break;
     }
 }
예제 #2
0
파일: AIThink.cs 프로젝트: Blecki/coerceo
 public override void Update(WorldScreen Game)
 {
     if (AsyncTask.IsCompleted)
     {
         Game.PushInputState(new AITurn(CurrentPlayer, AsyncTask.Result));
     }
 }
예제 #3
0
        private void AdvanceTurn(WorldScreen Game)
        {
            if (Actors.Count == 0) return;
            if (CurrentActor == null) CurrentActor = Actors[0];
            else
            {
                var cIndex = Actors.FindIndex(a => Object.ReferenceEquals(CurrentActor, a));
                cIndex += 1;
                if (cIndex == Actors.Count) cIndex = 0;
                CurrentActor = Actors[cIndex];
            }

            Game.PushInputState(new PlayerTurn(CurrentActor));
        }
예제 #4
0
파일: AITurn.cs 프로젝트: Blecki/coerceo
        public override void Update(WorldScreen Game)
        {
            Timer += Game.ElapsedSeconds;

            foreach (var piece in Game.PieceNodes)
            {
                var coordinate = piece.Tag as Coordinate?;
                if (coordinate == null || !coordinate.HasValue) continue;
                if (coordinate.Value == ChosenMove.Coordinate)
                    piece.Hilite = true;
            }

            if (Timer > 1)
            {
                if (ChosenMove.Type == (byte)MoveType.MovePiece)
                    Game.PushInputState(new AIMovePiece(ChosenMove));
                else
                {
                    var newBoard = Coerceo.ApplyMove(Game.CurrentBoard, ChosenMove);
                    Game.CurrentBoard = newBoard;
                    Game.PopInputState();
                }
            }
        }