Spell

This object represent an in-game spell. Each instance represents a single spell that will be encapsulated inside some SpellUser.

Attributes

readonly string name

The spell name.

string description

A simply text describing what the spells do.

Sprite icon

An icon that can be used in UI.

readonly Dictionary<SpellEventName, SpellEvent> events

The collections of all events.

float Cooldown

The duration the spell will stay in Reloading state.

float castTime

The duration the spell will stay in Casting state.

float maxPreparingTime

The maximum duration the spell can endure in Preparing state (before Casting). -1 to infinite.

float preparingTime

The duration the spell was in last Preparing state. Can be read to improove the spell effect. Should not be setted, just read.

bool canUseWithOthers

If setted to false, the spell user can't use other spell while this spell is in Preparing state.

Methods

Spell Spell(string name, SpellUser user, string description...)

The constructor. It's given an user and automatically added to it.

void ExecuteCommand(SpellCommand command)

A command that will take some action, depending on current spell state.

void SendInput(SpellInput input)

This is the method that should be used by players. It converts the SpellInput in the SpellCommand, depending on the spell setup.

void SetKeyToCommand(SpellInput input, SpellCommand command)

Bind the given input to execute the given command. This is uset to bind different inputs to different commands.

string GetStateName()

Returns the current state name of the spell.