예제 #1
0
        private void PlayStadiumCard(TrainerCard trainerCard)
        {
            trainerCard.RevealToAll();
            CurrentTrainerCard = trainerCard;
            TriggerAllAbilitiesOfType(TriggerType.TrainerCardPlayed);

            GameLog.AddMessage(ActivePlayer.NetworkPlayer?.Name + " Plays " + trainerCard.GetName());
            PushGameLogUpdatesToPlayers();

            ActivePlayer.Hand.Remove(trainerCard);

            var trainerEvent = new StadiumCardPlayedEvent()
            {
                Card   = trainerCard,
                Player = ActivePlayer.Id
            };

            SendEventToPlayers(trainerEvent);

            trainerCard.Process(this, ActivePlayer, NonActivePlayer);

            if (StadiumCard != null)
            {
                StadiumCard.Owner.DiscardPile.Add(StadiumCard);
            }

            StadiumCard = trainerCard;

            CurrentTrainerCard = null;

            if (ActivePlayer.IsDead)
            {
                GameLog.AddMessage($"{ActivePlayer.NetworkPlayer?.Name} loses because they drew to many cards");
                EndGame(NonActivePlayer.Id);
            }

            SendEventToPlayers(new GameInfoEvent {
            });
        }
예제 #2
0
        public void Trigger(StadiumCardPlayedEvent stadiumEvent)
        {
            if (stadiumGameCard.card != null)
            {
                var player = stadiumGameCard.card.Owner.Id.Equals(GameController.Instance.myId) ? GameController.Instance.Player : GameController.Instance.OpponentPlayer;
                player.DiscardPile.Add(stadiumEvent.Card);
            }

            stadiumGameCard.SetCard(stadiumEvent.Card, false, false);
            var rectTransform = stadiumGameCard.GetComponent <RectTransform>();

            if (stadiumEvent.Card.Owner.Id.Equals(GameController.Instance.myId))
            {
                GameController.Instance.playerHand.RemoveCard(stadiumEvent.Card);
            }

            rectTransform.localScale = new Vector3(2, 2, 2);
            rectTransform.LeanScale(new Vector3(1, 1, 1), 0.35f).setOnComplete(() =>
            {
                GameEventHandler.Instance.EventCompleted();
            });
        }