public JumpState_Com_Player(GameDevice gameDevice, eJumpType jumpType, float nowSpeed) { this.gameDevice = gameDevice; inputState = gameDevice.GetInputState; jumpComp = new C_JumpWithController(Parameter.PlayerLimitSpeed, inputState, jumpType); jumpComp.speed = nowSpeed; }
public C_JumpWithController(float speed, InputState inputState, eJumpType jumpType) : base(speed, Vector2.Zero) { this.inputState = inputState; startSpeed = speed; currentJumpPower = (int)jumpType; isWall = false; isWallDirection = 0; }
private void checkAndChangeTurn() { if (m_LastJumpType == eJumpType.Normal || m_ActivePlayer.LegalJumpList.Count == 0 || m_IsLastJumpPawnBecomesKing == true) { m_LastJumpType = eJumpType.Illegal; m_IsPlayerInCapturingSequence = false; m_IsLastJumpPawnBecomesKing = false; updateLegalJumpList(); toggleActivePlayer(); updateLegalJumpList(); updateGameStatus(); } }
public void PlayNewRound() { updateEndGamePlayersTotalRank(); initializeCheckersPlayer(m_CheckersPlayer1); initializeCheckersPlayer(m_CheckersPlayer2); m_Board.ClearAllPawnsOnBoard(); m_Board.SetIntialPawnsPositionOnSquare(); m_LastJumpType = eJumpType.Illegal; m_IsPlayerInCapturingSequence = false; m_IsLastJumpPawnBecomesKing = false; associatePawnsToPlayer(m_CheckersPlayer1); associatePawnsToPlayer(m_CheckersPlayer2); RandomFirstTurnPlayer(); GameStatus = eGameStatus.Playing; }
private eJumpType pawnJumpType(Pawn i_Pawn, Square i_Dest) { eJumpType jumpType = eJumpType.Illegal; int rowNormalStepSize = (int)i_Pawn.Direction; if (isNormalJump(i_Pawn, i_Dest)) { jumpType = eJumpType.Normal; } else if (isCaptureJump(i_Pawn, i_Dest)) { jumpType = eJumpType.Capture; } return(jumpType); }
private bool isValidJump(Pawn i_Pawn, Square i_Dest) { bool isValidJump = false; if (i_Pawn != null && i_Dest != null && m_ActivePlayer.ID == i_Pawn.Belong) { eJumpType jumpType = pawnJumpType(i_Pawn, i_Dest); if ((m_IsPlayerInCapturingSequence == true && i_Pawn == m_ActivePlayer.LastActivatedPawn && jumpType == eJumpType.Capture) || (m_IsPlayerInCapturingSequence == false && (jumpType == eJumpType.Capture || (m_LastJumpType != eJumpType.Capture && m_ActivePlayer.IsCaptureAvailable == false && jumpType == eJumpType.Normal)))) { isValidJump = true; } } return(isValidJump); }
private void executeJump(Pawn i_Pawn, Square i_Dest) { eJumpType jumpType = pawnJumpType(i_Pawn, i_Dest); if (jumpType == eJumpType.Normal) { m_LastJumpType = eJumpType.Normal; } else if (jumpType == eJumpType.Capture) { m_LastJumpType = eJumpType.Capture; m_IsPlayerInCapturingSequence = true; } m_ActivePlayer.LastActivatedPawn = i_Pawn; jumpPawn(i_Pawn, i_Dest, jumpType); updateLegalJumpList(); checkAndChangeTurn(); }
private void jumpPawn(Pawn i_Pawn, Square i_Dest, eJumpType i_StepType) { if (i_StepType == eJumpType.Capture) { Square capturedSquare = findSquareBetween(i_Pawn.OnSquare, i_Dest); Pawn capturedPawn = capturedSquare.Pawn; if (capturedPawn.Belong == ePlayerID.Player1) { m_CheckersPlayer1.RemovePawn(capturedPawn); } else { m_CheckersPlayer2.RemovePawn(capturedPawn); } capturedSquare.Pawn = null; } i_Pawn.OnSquare.Pawn = null; i_Pawn.OnSquare = i_Dest; checkAndBecomesKingPawn(m_ActivePlayer.LastActivatedPawn); i_Dest.Pawn = i_Pawn; }