Exemple #1
0
 private void CancelSpell()
 {
     if (CurrentSpell == null || CurrentSpell.Equals(null))
     {
         CurrentSpell = null;
         SpellElement = SpellElement.None;
         SpellTier    = SpellTier.None;
         State        = SpellCastingState.Select;
     }
     else
     {
         bool success = CurrentSpell.Deactivate();
         if (success)
         {
             CurrentSpell = null;
             SpellElement = SpellElement.None;
             SpellTier    = SpellTier.None;
             State        = SpellCastingState.Select;
         }
     }
 }
Exemple #2
0
    public void PublishGesture(ISpellGesture gesture)
    {
        bool spellWasDestroyed = CurrentSpell != null && CurrentSpell.Equals(null);

        //Process cancel gesture.
        //A spell can be canceled at any time.
        if (gesture.IsCancel || spellWasDestroyed)
        {
            State = SpellCastingState.Cancel;
        }

        switch (State)
        {
        case SpellCastingState.None:
            break;

        case SpellCastingState.Select:
            SelectSpell(gesture);
            break;

        case SpellCastingState.Adjust:
            AdjustSpell(gesture);
            break;

        case SpellCastingState.Cast:
            CastSpell(gesture);
            break;

        case SpellCastingState.Cancel:
            CancelSpell();
            break;

        default:
            throw new System.InvalidOperationException("Illegal enum value.");
        }
    }
Exemple #3
0
    private IEnumerator MonitorChanneledSpell()
    {
        yield return(new WaitUntil(() => CurrentSpell == null || CurrentSpell.Equals(null)));

        CancelSpell();
    }