コード例 #1
0
ファイル: Player.cs プロジェクト: AlanWills/SpaceCardGame
        /// <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);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: AlanWills/SpaceCardGame
        /// <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);
        }