Beispiel #1
0
    public void LoadUnitData()
    {
        if (_unitData == null)
        {
            return;
        }

        UnitName               = _unitData.UnitName;
        _unitID                = _unitData.UnitID;
        _deckClass             = _unitData.DeckClass;
        _baseHP                = _unitData.BaseHP;
        _spriteRenderer.sprite = Resources.Load <Sprite>("Sprites/Units/" + _unitData.SpritePath);

        UpdateUI();
    }
Beispiel #2
0
    public void LoadCardData()
    {
        if (cardData != null)
        {
            title         = cardData.Title;
            characterType = cardData.CharacterType;
            deckType      = cardData.DeckType;
            category      = cardData.Category;
            resourceCost  = cardData.ResourceCost;
            description   = cardData.Description;
            omitFromDeck  = cardData.OmitFromDeck;
            requireTarget = cardData.RequireTarget;
            targetType    = cardData.TargetType;
            areaOfEffect  = cardData.AreaOfEffect;
            targetArea    = cardData.TargetArea;
            effects       = cardData.Effects;

            // Do not save.
            owner = cardData.Owner;
        }
    }
Beispiel #3
0
    public CardData DrawRandomCard(Card.DeckClass deckClass, List <CardData> handList, bool removeCard = true)
    {
        if (deck.Count == 0)
        {
            PopulateDeckFromReference(handList);
        }

        // For ai control
        if (UnityEngine.Random.value < 0.15f)
        {
            foreach (CardData data in deck)
            {
                if (data.Title == "Block")
                {
                    return(data);
                }
            }
        }

        CardData cardData;
        int      ndx      = -1;
        int      attempts = 0;

        do
        {
            ndx      = UnityEngine.Random.Range(0, deck.Count);
            cardData = deck[ndx];
        } while(cardData.DeckType != deckClass && attempts < 500);

        if (ndx > -1 && removeCard)
        {
            deck.RemoveAt(ndx);
        }

        return(cardData);
    }
Beispiel #4
0
 public void LoadCardsByClass(Card.DeckClass deckClass)
 {
 }