本文整理汇总了C#中IBoard.SwitchStones方法的典型用法代码示例。如果您正苦于以下问题:C# IBoard.SwitchStones方法的具体用法?C# IBoard.SwitchStones怎么用?C# IBoard.SwitchStones使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBoard
的用法示例。
在下文中一共展示了IBoard.SwitchStones方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FSM_SinglePlayer
/// <summary>
/// Single player mode
/// </summary>
/// <param name="gameLogic"></param>
/// <param name="models"></param>
/// <param name="gameSettings"></param>
#region private static void FSM_SinglePlayer(...)
private static void FSM_SinglePlayer(Connect4Game gameLogic, GameSettings gameSettings, IBoard board)
{
switch (gameLogic.GameState)
{
case GameSettings.GAMESTATE.S_BeforeGame:
{
if (gameLogic.STARTING_PLAYER == gameSettings.RED_PLAYER)
{
gameLogic.GameState = GameSettings.GAMESTATE.S_Player1Move;
gameLogic.HUMAN_PLAYER = gameSettings.RED_PLAYER;
}
else
{
gameLogic.GameState = GameSettings.GAMESTATE.S_WaitForCPU;
gameLogic.HUMAN_PLAYER = gameSettings.YELLOW_PLAYER;
}
break;
}
case GameSettings.GAMESTATE.S_Player1Move:
{
//HandleMouseInput(gameSettings, gameLogic);
//HandleKeyInput(gameSettings, gameLogic);
break;
}
case GameSettings.GAMESTATE.S_DropPlayerStone:
{
if (board.DropStone(gameLogic))
{
if (board.Bounce())
gameLogic.GameState = GameSettings.GAMESTATE.S_SwitchPlayer;
}
break;
}
case GameSettings.GAMESTATE.S_SwitchPlayer:
{
// Change player
gameLogic.SwitchPlayer();
gameLogic.CheckIfFinished();
if (gameLogic.NextGameState == GameSettings.GAMESTATE.S_GameFinished)
{
gameLogic.GameState = GameSettings.GAMESTATE.S_GameFinished;
}
else
{
board.SwitchStones(gameLogic);
if (gameLogic.activePlayer == gameSettings.RED_PLAYER)
{
// Reset stone position for the next new stone
gameLogic.SetNextPlayerStone();
gameLogic.GameState = GameSettings.GAMESTATE.S_Player1Move;
}
else
{
gameLogic.GameState = GameSettings.GAMESTATE.S_WaitForCPU;
}
}
break;
}
case GameSettings.GAMESTATE.S_WaitForCPU:
{
// Start the AI
if (!gameLogic.AIStarted)
{
gameLogic.CPUMove();
}
if (gameLogic.NextGameState == GameSettings.GAMESTATE.S_DropCPUStone)
{
gameLogic.AbortAI();
board.Update(gameLogic.column * board.ColumnDistance);
gameLogic.GameState = GameSettings.GAMESTATE.S_DropCPUStone;
}
break;
}
case GameSettings.GAMESTATE.S_DropCPUStone:
{
if (board.DropStone(gameLogic))
{
if (board.Bounce())
gameLogic.GameState = GameSettings.GAMESTATE.S_SwitchPlayer;
}
//.........这里部分代码省略.........