示例#1
0
    private void CastSpell(ISpellGesture gesture)
    {
        //If attempting to cast and CurrentSpell isn't activated, activate
        //Otherwise, adjust
        if (gesture.IsCast && !CurrentSpell.IsActive)
        {
            bool success = CurrentSpell.Activate();

            //Failed to activate spell, so return to Adjust state.
            if (!success)
            {
                State = SpellCastingState.Adjust;
                return;
            }

            //If the spell isn't channeled, prepare to cast a new spell
            if (success && !CurrentSpell.IsChanneled)
            {
                CurrentSpell = null;
                SpellElement = SpellElement.None;
                SpellTier    = SpellTier.None;
                State        = SpellCastingState.Select;
            }
            else
            {
                StartCoroutine(MonitorChanneledSpell());
            }
        }
        else
        {
            AdjustSpell(gesture);
        }
    }