예제 #1
0
 public PlayerData(
     DrawOrder drawOrder,
     PlayerKey key,
     int currentMana,
     int maxMana)
 {
     this.drawOrder     = drawOrder;
     this.fieldEntities = new List <IFieldEntity>();
     this.hand          = new List <ICardInstance>();
     this.key           = key;
     this.currentMana   = currentMana;
     this.maxMana       = maxMana;
 }
예제 #2
0
        public MatchData(
            Decklist deckPlayer1,
            Decklist deckPlayer2,
            Vector2Int gridSizeX,
            Vector2Int crystalPosition,
            int crystalStrength)
        {
            playerDatas   = new Dictionary <PlayerKey, PlayerData>();
            cardInstances = new Dictionary <ICardInstance, PlayerKey>();
            fieldEntities = new Dictionary <Vector2Int, IFieldEntity>();

            player1Key = new PlayerKey();
            player2Key = new PlayerKey();

            List <ICardInstance> player1Instances = new List <ICardInstance>();
            List <ICardInstance> player2Instances = new List <ICardInstance>();

            foreach (DecklistEntry entry in deckPlayer1.cards)
            {
                ICardData     cardData     = Cards.DB[entry.cardName];
                ICardInstance cardInstance = Cards.CreateCardInstance(cardData, player1Key);

                cardInstances.Add(cardInstance, player1Key);
                player1Instances.Add(cardInstance);
            }
            foreach (DecklistEntry entry in deckPlayer2.cards)
            {
                ICardData     cardData     = Cards.DB[entry.cardName];
                ICardInstance cardInstance = Cards.CreateCardInstance(cardData, player2Key);

                cardInstances.Add(cardInstance, player1Key);
                player2Instances.Add(cardInstance);
            }
            DrawOrder drawOrderP1 = new DrawOrder(player1Instances);
            DrawOrder drawOrderP2 = new DrawOrder(player2Instances);

            playerDatas.Add(player1Key, new PlayerData(drawOrderP1, player1Key, 5, 5));
            playerDatas.Add(player2Key, new PlayerData(drawOrderP2, player2Key, 5, 5));

            _crystal = new Crystal(crystalStrength);

            new FieldEntity <Crystal>(this, _crystal, crystalPosition);
            this.crystalPosition = crystalPosition;
            currentState         = new MatchState(MatchStateType.Idle, player1Key, player2Key);
        }