コード例 #1
0
    public Card FindCard(CardType type)
    {
        List <Card> temp = new List <Card> (0);

        foreach (Card c in allCards)
        {
            if (c.Type == type)
            {
                temp.Add(c);
            }
        }
        if (temp.Count == 0)
        {
            return(null);
        }
        return(temp[Random.Range(0, temp.Count)]);
    }
コード例 #2
0
ファイル: Card.cs プロジェクト: jthpotz/40-ludum-dare
    public void InitCard(int w, int a, int v, int u, int c, int tel, CardType t, CardName n, CardEffect e = CardEffect.None)
    {
        weight   = w;
        attack   = a;
        value    = v;
        uses     = u;
        capacity = c;
        teleport = tel;
        type     = t;
        name     = n;

        actionEnum = e;
        switch (e)
        {
        case CardEffect.ChangeCapacity:
            action = ChangeCapacity;
            break;

        case CardEffect.AttackCard:
            action = AttackCard;
            break;

        case CardEffect.Transport:
            action = Transport;
            break;

        case CardEffect.Struggle:
            action = Struggle;
            break;

        default:
            break;
        }

        BuildCardVisuals(this);
    }