Пример #1
0
        public Boolean PlaceCardOnField(PlayerType player, FieldPosition fieldPosition, Card card)
        {
            if (player == PlayerType.Player)
            {
                if (!fieldPosition.HasCard)
                {
                    if (card is SpellCard)
                    {
                        card.State = CardState.Back;
                    }
                    fieldPosition.Card = card;
                    card.UpdatePositions();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else //enemy
            {
                if (!fieldPosition.HasCard)
                {
                    if (card is MonsterCard)
                    {
                        card.State = CardState.Front;
                    }
                    else
                    {
                        card.State = CardState.Back;
                    }

                    fieldPosition.Card = card;
                    card.UpdatePositions();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #2
0
 public PlayerField(PlayerType playerType)
 {
     playerMonsterField = new FieldPosition[5];
     playerSpellField   = new FieldPosition[5];
     this.playerType    = playerType;
     if (playerType == PlayerType.Player)
     {
         int count = 1;
         for (int i = 0; i < 5; i++)
         {
             playerMonsterField[i] = new FieldPosition(playerType, count, FieldType.Monster);
             count++;
         }
         count = 1;
         for (int i = 0; i < 5; i++)
         {
             playerSpellField[i] = new FieldPosition(playerType, count, FieldType.Spell);
             count++;
         }
     }
     else
     {
         int count = 1;
         for (int i = 0; i < 5; i++)
         {
             playerMonsterField[i] = new FieldPosition(playerType, count, FieldType.Monster);
             count++;
         }
         count = 1;
         for (int i = 0; i < 5; i++)
         {
             playerSpellField[i] = new FieldPosition(playerType, count, FieldType.Spell);
             count++;
         }
     }
 }