示例#1
0
    void CastTargetedSpell(TileData tile, Point pos)
    {
        ISpellBehaviour behaviour = spellBehaviours[spellsData[selectedSpell].behaviour];

        if (((ITargetableSpell)behaviour).TargetableTiles.Contains(tile.id))
        {
            // FIXME: Target not being set.
            Debug.Log("Fixing tile at " + pos.x + "," + pos.y);
            ((ITargetableSpell)behaviour).Target = pos;
            Debug.Log("F****n cast that shit at " + ((ITargetableSpell)behaviour).Target.x + "," + ((ITargetableSpell)behaviour).Target.y);
            behaviour.Execute();
            OnSpellCast(spellsData[selectedSpell]);
            OnSpellEndTarget();
        }
    }
示例#2
0
    void CastSpell()
    {
        CloseSpellBook();

        Debug.Log("Casting spell - " + selectedSpell.ToString());
        ISpellBehaviour behaviour = spellBehaviours[spellsData[selectedSpell].behaviour];

        // If the spell needs a target then get one.
        if (behaviour is ITargetableSpell)
        {
            OnSpellBeginTarget();
        }
        else
        {
            behaviour.Execute();
            OnSpellCast(spellsData[selectedSpell]);
        }
    }