コード例 #1
0
ファイル: Deck.cs プロジェクト: JarkoDubbeldam/Hanabi
 public bool TryDraw(out Card?card)
 {
     if (!HasCards)
     {
         card = null;
         DeckIsEmpty?.Invoke(this, new EventArgs());
         return(false);
     }
     card = Cards.Pop();
     return(true);
 }
コード例 #2
0
        internal StateManager(StateObject stateObject)
        {
            Logger.Logger.Log("Initialising State Manager");

            // Initialising all the state objects
            Logger.Logger.Log("Initialising all the state objects");
            resetState = new Reset(this);
            cardDrewState = new CardDrawn(this);
            deckShuffledState = new DeckShuffled(this);
            deckIsEmptyState = new DeckIsEmpty(this);

            // Updating the StateObject with inital values, i.e., newly reset deck and initial current state are "RESET"
            Logger.Logger.Log("Updating the StateObject with inital values");
            this.stateObject = stateObject;
            deck = new Deck(this.stateObject);
        }