コード例 #1
0
ファイル: Rulls.cs プロジェクト: yarivbracha/repository
 public bool IsValidMoves(int cube, Player.GameStatus status)
 {
     bool isValid;
     if (status == Player.GameStatus.Start)
     {
         isValid = IsValidMoveForStart(cube);
     }
     else if (status == Player.GameStatus.Out)
     {
         isValid = IsValidMoveForOut(cube);
     }
     else
     {
         isValid = IsValidMoveForFinish(cube);
     }
     return isValid;
 }
コード例 #2
0
 public string StartGame()
 {
     cubes.RollCube();
     while(cubes.FirstCube == cubes.SecondCube)
     {
         cubes.RollCube();
     }
     if(cubes.FirstCube > cubes.SecondCube)
     {
         currentPlayer = firstPlayer;
     }
     else
     {
         currentPlayer = secondPlayer;
     }
     return CurrentPlayer.Name;
 }
コード例 #3
0
 private void InitPlayers(GameMode gameMode, string firstPlayerName, string secondPlayerName)
 {
     if(gameMode == GameMode.Friend)
     {
         firstPlayer = new HumenPlayer(firstPlayerName, Color.Blue);
         secondPlayer = new HumenPlayer(secondPlayerName, Color.Red);
     }
     else if(gameMode == GameMode.Computer)
     {
         firstPlayer = new HumenPlayer(firstPlayerName, Color.Blue);
         secondPlayer = new ComputerPlayer("Computer", Color.Red);
     }
     else
     {
         firstPlayer = new ComputerPlayer("First Computer", Color.Blue);
         secondPlayer = new ComputerPlayer("Second Computer", Color.Red);
     }
 }
コード例 #4
0
 public void SwitchPlayer()
 {
     if(CurrentPlayer == firstPlayer)
     {
         currentPlayer = secondPlayer;
     }
     else
     {
         currentPlayer = firstPlayer;
     }
 }