Пример #1
0
 /// <summary>
 /// Draw cards from our deck instance if we have room in our hand
 /// </summary>
 /// <param name="numberOfCards"></param>
 public void DrawCard(int numberOfCards = 1)
 {
     for (int i = 0; i < numberOfCards; i++)
     {
         Card card = DeckInstance.Draw();
         TriggerDrawCardEvents(card);
     }
 }
Пример #2
0
        /// <summary>
        /// Draws a card from the deck of a certain type - useful for the beginning of the game to enforce certain cards appear in the player's hand.
        /// Also useful in certain abilities which add a card type to your hand.
        /// For example, to add a MissileBarrageAbilityCard to your hand, use DrawCard("MissileBarrageAbilityCard").
        /// </summary>
        /// <param name="resourceType"></param>
        public void DrawCard(string cardTypeName)
        {
            Debug.Assert(DeckInstance.Exists(x => x.GetType().Name == cardTypeName));
            Card card = DeckInstance.Find(x => x.GetType().Name == cardTypeName);

            DeckInstance.Remove(card);

            TriggerDrawCardEvents(card);
        }
Пример #3
0
        /// <summary>
        /// A function which obtains the data for the station in the player's deck and removes it from the deck so that we cannot draw it.
        /// Used at the start of the game to get the station data so we can add it to our board straightaway.
        /// </summary>
        /// <returns></returns>
        public StationCard GetStationData()
        {
            // This assert should NEVER trigger.  If it does, it means that the player has no station chosen.
            // This quite simply CANNOT happen otherwise we have no basis for a game!
            Debug.Assert(DeckInstance.Exists(x => x is StationCard));
            StationCard station = DeckInstance.Find(x => x is StationCard) as StationCard;

            DeckInstance.Remove(station);

            return(station);
        }
Пример #4
0
        public Player(Deck chosenDeck)
        {
            ResourceCardsPlacedThisTurn = 0;
            CurrentShipsPlaced          = 0;
            MaxHandSize        = 10;
            CardsToDrawPerTurn = 3;

            // Set up our resources array
            Resources = new List <ResourceCard>[(int)ResourceType.kNumResourceTypes]
            {
                new List <ResourceCard>(),
                new List <ResourceCard>(),
                new List <ResourceCard>(),
                new List <ResourceCard>()
            };

            CurrentHand  = new List <Card>();
            DeckInstance = new DeckInstance(this, chosenDeck);
        }