Ejemplo n.º 1
0
    protected virtual void DrawCardEffect(string cardName, bool byController, Action conpleteEffect)
    {
        Vector3    pos    = Vector3.zero;
        GameObject prefab = null;
        Card       info   = CardData.Instance.GetCard(cardName, false);

        Card.Type type = info.type;

        if (type == Card.Type.bonus)
        {
            pos    = bonusPilePos.position;
            prefab = bonusCardPrefab;
        }
        else if (type == Card.Type.mogi)
        {
            pos    = mogisPilePos.position;
            prefab = mogisCardPrefab;
        }

        GameObject cardObj = Instantiate(prefab, pos, Quaternion.identity);

        CardEntity entity = cardObj.GetComponent <CardEntity>();

        CardDisplay display = cardObj.GetComponent <CardDisplay>();

        display.Init(cardName);
        cardObj.name = cardName;
        CardMotion motion = cardObj.GetComponent <CardMotion>();

        motion.Init(entity);
        entity.Init(info, display, motion, byController);

        motion.PileToHand(conpleteEffect);
    }