Пример #1
0
    void CheckSpellCast(int spellNum)
    {
        if (spellNum >= firstSpellNum && hotSpells.ContainsKey(spellNum) && !casting)
        {
            // print("notnull");
            if (!hotSpells[spellNum].SpellScript.NeedsTarget)
            {
                bool readyToCast = spellCasterScript.CheckCastable(hotSpells[spellNum]);

                if (readyToCast)    //if spell not cooling down and other spell not being cast
                {
                    //if free spells is selected with god mode on, players spells no longer cost mana
                    if (GameManager.FreeSpells)
                    {
                        CastSpell(spellNum);
                    }
                    //if enough mana
                    //needs to be nested inside the readyToCast because if there is enough mana it will decrease inside of CheckMana possibly without casting
                    else if (spellCasterScript.CheckMana(hotSpells[spellNum]))
                    {
                        CastSpell(spellNum);
                    }
                }
            }
        }
    }