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; } }
public override void Update(WorldScreen Game) { if (AsyncTask.IsCompleted) { Game.PushInputState(new AITurn(CurrentPlayer, AsyncTask.Result)); } }
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)); }
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(); } } }