public BangState GetState() { BangState toRet = _currentState; if (_currentState == BangState.NEW_CARD_UNKNOWN || _currentState == BangState.DODGE_PLAYED) { _currentState = BangState.BASE; } return(toRet); }
public BangState GetStateForPlayer(int plID) { BangState toRet = BangState.BASE; if (_playersStatusHolder[plID].PlayerState != BangState.BASE) { toRet = _playersStatusHolder[plID].PlayerState; _playersStatusHolder[plID].PlayerState = BangState.BASE; } return(toRet); }
public void InitARBangStateMachine(int numOfPlayers) { _currentState = BangState.BASE; _playersStatusHolder.Clear(); for (var i = 0; i < numOfPlayers; ++i) { PlayerStatus plStat = new PlayerStatus(); plStat.PlayerState = BangState.BASE; plStat.range = 1; _playersStatusHolder.Add(i + 1, plStat); } }
/// <summary> /// Perform Bang state update, after the new card in common area Appear. /// </summary> /// <param name="playerID"></param> /// <param name="cardID"></param> /// <param name="packageID"> </param> /// <returns>Returns true if the change have visual consequencies, otherwise return false.</returns> public bool ApplyNewCommonData(int playerID, BangCard cardID, CommonAreaPackages packageID) { if (cardID == BangCard.UNKNOWN) { _currentState = BangState.NEW_CARD_UNKNOWN; } else if (cardID == BangCard.BANG_A || cardID == BangCard.BANG_B) { _currentState = BangState.BANG_PLAYED; } else if ((cardID == BangCard.DODGE_A || cardID == BangCard.DODGE_A_M || cardID == BangCard.DODGE_B || cardID == BangCard.DODGE_B_M) && _currentState == BangState.BANG_PLAYED) { _currentState = BangState.DODGE_PLAYED; } return(true); }