Beispiel #1
0
    public override void Execute(Action action)
    {
        Card card;

        //THe case of a deal card being send before a creat rune, EX.(A card in the other persons hand)
        if (EntityManager.Singelton.GetEntity(cardGuid) != null)
        {
            CardAvatar ca = (EntityManager.Singelton.GetEntity(cardGuid) as Card).GetCardAvatar();
            Debug.Log(ca);
            EntityManager.Singelton.RemoveEntity(cardGuid);
            if (type == CardType.minion)
            {
                card = new MinionCard();
                MinionCard mc = card as MinionCard;
                CardDataLoader.CardData cd = CardDataLoader.Singelton.GetCardData(id);

                mc.SetName(cd.cardName);
                mc.SetArt(cd.art);
                mc.SetBaseAttack(baseAttack);
                mc.SetBaseHealth(baseHealth);
                mc.SetMana(cost);
                mc.SetGuid(cardGuid);
                mc.SetDesc(cd.desc);
                mc.SetCardAvatar(ca);
                EntityManager.Singelton.AddEntity(cardGuid, mc);
                ca.Setup(card, cardGuid, controllerGuid);
            }
        }
        else
        {
            if (type == CardType.minion)
            {
                MinionCard mc = new MinionCard();
                CardDataLoader.CardData cd = CardDataLoader.Singelton.GetCardData(id);
                mc.SetCardText(cd.cardText);
                mc.SetName(cd.cardName);
                mc.SetArt(cd.art);
                mc.SetBaseAttack(baseAttack);
                mc.SetBaseHealth(baseHealth);
                mc.SetMana(cost);
                mc.SetGuid(cardGuid);
                mc.SetDesc(cd.desc);
                EntityManager.Singelton.AddEntity(cardGuid, mc);
            }
            else if (type == CardType.spell)
            {
                SpellCard sc = new SpellCard();
                CardDataLoader.CardData cd = CardDataLoader.Singelton.GetCardData(id);

                sc.SetName(cd.cardName);
                sc.SetArt(cd.art);
                sc.SetMana(cost);
                sc.SetDesc(cd.desc);
                sc.SetGuid(cardGuid);
                sc.SetCardType((int)type);
                EntityManager.Singelton.AddEntity(cardGuid, sc);
            }
        }
        action();
    }