Пример #1
0
 private void DiscardCards()
 {
     foreach (var card in _discardingCards)
     {
         card.HideHighlight();
         EventMoveDeckCard.MoveCardToShareDeck(card.Entity);
     }
 }
Пример #2
0
    public void MoveToBox(CardObject card)
    {
        if (!CanUseCard())
        {
            return;
        }

        EventMoveDeckCard.MoveCardInToBox(card.Entity);
        CloseAction();
    }
Пример #3
0
    public void DiscardCard(CardObject card)
    {
        if (!CanUseCard())
        {
            return;
        }

        EventMoveDeckCard.MoveCardToShareDeck(card.Entity);
        CloseAction();
    }
Пример #4
0
        public void MoveToShareDeck()
        {
            var system = new EventMoveCardSystem(_contexts);

            var p1   = CreatePlayerEntity(1);
            var card = _contexts.card.CreateEntity();

            card.AddDeckCard(DeckCard.Move);
            card.AddOwner(p1);

            EventMoveDeckCard.MoveCardToShareDeck(card);

            system.Execute();

            Assert.IsFalse(card.hasOwner);
        }
Пример #5
0
        public void MoveInToBox()
        {
            var system = new EventMoveCardSystem(_contexts);

            var p1 = CreatePlayerEntity(1);

            var card = _contexts.card.CreateEntity();

            card.AddDeckCard(DeckCard.Move);
            card.AddOwner(p1);

            EventMoveDeckCard.MoveCardInToBox(card);

            system.Execute();

            Assert.AreEqual(p1, card.owner.Entity);
            Assert.IsTrue(card.hasInBox);
        }
Пример #6
0
        public void MoveToPlayer()
        {
            var system = new EventMoveCardSystem(_contexts);

            var p1 = CreatePlayerEntity(1);
            var p2 = CreatePlayerEntity(2);

            var card = _contexts.card.CreateEntity();

            card.AddDeckCard(DeckCard.Move);
            card.AddOwner(p1);


            EventMoveDeckCard.MoveCardToPlayer(card, p2);

            system.Execute();

            Assert.AreEqual(p2, card.owner.Entity);
        }
Пример #7
0
    protected override void Execute(List <GameEntity> entities)
    {
        foreach (var e in entities)
        {
            var movingCards = _eventContext.GetEntities(GameEventMatcher.EventMoveDeckCard)
                              .Select(ev => ev.eventMoveDeckCard.CardEntity);
            var cards = _cardContext.GetEntities(CardMatcher.DeckCard)
                        .Except(movingCards)
                        .ToArray()
                        .Shuffle();

            if (cards.Length > 0)
            {
                var drawCards = cards.Take(Math.Min(cards.Length, _setting.StartTurnDrawCount));
                foreach (var c in drawCards)
                {
                    EventMoveDeckCard.MoveCardToPlayer(c, e);
                }
            }
        }
    }
Пример #8
0
        public void CreateEvent()
        {
            var p1 = CreatePlayerEntity(1);
            var p2 = CreatePlayerEntity(2);

            var card = _contexts.card.CreateEntity();

            card.AddDeckCard(DeckCard.Move);
            card.AddOwner(p1);

            EventMoveDeckCard.MoveCardToPlayer(card, p2);

            var eventEntity = _contexts.gameEvent.GetEntities();

            Assert.AreEqual(1, eventEntity.Length);
            Assert.IsTrue(eventEntity[0].hasEventMoveDeckCard);

            var e = eventEntity[0].eventMoveDeckCard;

            Assert.AreEqual(card, e.CardEntity);
            Assert.AreEqual(p2, e.TargetPlayerEntity);
        }
Пример #9
0
    protected override void Execute(List <GameEntity> entities)
    {
        var players     = _gameContext.GetEntities(GameMatcher.Player);
        var movingCards = _eventContext.GetEntities(GameEventMatcher.EventMoveDeckCard)
                          .Select(e => e.eventMoveDeckCard.CardEntity);
        var cards = _cardContext.GetEntities(CardMatcher.DeckCard)
                    .Except(movingCards)
                    .ToArray()
                    .Shuffle();

        Assert.IsTrue(players.Count() * _setting.StartCardCount <= cards.Length);

        var i = 0;

        foreach (var p in players)
        {
            _setting.StartCardCount.Loop(() =>
            {
                EventMoveDeckCard.MoveCardToPlayer(cards[i], p);
                i++;
            });
        }
    }