Inheritance: MonoBehaviour
Exemplo n.º 1
0
 public MagicAttacks(string name, string spelldescribe, int damage, MagicDamgeType attackType, SpellTier spellLvl, int magiclvlrequrements, int price, bool buyable, List <ItemType> itemTags, int itemvalue, bool questitem, Rarity rare)
 {
     Name                = name;
     ItemDescribe        = spelldescribe;
     Damage              = damage;
     AttackType          = attackType;
     SpellLvl            = spellLvl;
     Price               = price;
     Buyable             = buyable;
     MyItemType          = itemTags;
     ItemValue           = itemvalue;
     QuestItem           = questitem;
     MyRare              = rare;
     MagicLvlReqiurement = magiclvlrequrements;
 }
Exemplo n.º 2
0
    private void SelectSpell(ISpellGesture gesture)
    {
        //Extract element and tier from the gesture
        SpellElement?elem = gesture.Element;
        SpellTier?   tier = gesture.Tier;

        //If elem/tier exist, store their value
        SpellElement = elem.GetValueOrDefault(SpellElement);
        SpellTier    = tier.GetValueOrDefault(SpellTier);

        //If an element and tier have been selected, transition to the Adjust state
        if (SpellElement != SpellElement.None && SpellTier != SpellTier.None)
        {
            foreach (Spell spellPrefab in spellPrefabs)
            {
                if (spellPrefab.Element == SpellElement && spellPrefab.Tier == SpellTier)
                {
                    CurrentSpell = Instantiate(spellPrefab, gesture.AttachmentPoint);
                    State        = SpellCastingState.Adjust;
                    AdjustSpell(gesture);
                    break;
                }
            }

            if (CurrentSpell == null)
            {
                Debug.LogWarningFormat(
                    "No spell prefab found for (Element, Tier) = ({0}, {1})",
                    SpellElement.ToString(), SpellTier.ToString()
                    );

                SpellElement = SpellElement.None;
                SpellTier    = SpellTier.None;
            }
        }
    }