Example #1
0
        public Spell(string name, int damage, int level, string description, ICastSpell primarySpellAction)

        {
            Name                    = name;
            Damage                  = damage;
            Level                   = level;
            Description             = description;
            this.primarySpellAction = primarySpellAction;
        }
    private IEnumerator VisitCall(JObject obj)
    {
        validate(obj, "type", "Call");

        var callable = (JObject)obj["expr"];
        // var prms = (object)obj["params"];
        ICastSpell spell = (ICastSpell)VisitExpression(callable); //check is of type

        // Player casts
        yield return(CallSkill(spell));
    }
    /* Skills */

    private IEnumerator CallSkill(ICastSpell spell)
    {
        if (spell.isWorthy(stats))
        {
            stats.castCounter++;
            yield return(new WaitForSeconds(0.5f));

            spell.cast();
            spell.applyOnCast(stats);
        }
        yield break;
    }
 public void CastSpell(Spell spell)
 {
     spellAction = spell.primarySpellAction;
     spellAction.Cast(spell);
 }