Create Spells

In the “SpellManager.cs/.js” script, each spell represents an element of the “Spells” array:


General Settings:

1) Name: Spell’s name.

2) Description: Spell’s short description to be displayed in the spell book.

3) Spell Sprite: Spell’s icon to be displayed in the spell book/spell bar slots.

4) Mana Needed: Mana points needed to cast this spell.

5) Cast Delay: Delay time before casting the spell.

6) Recharge: Time needed to cast this spell again.

7) Use Trigger Key: Tick this option to cast the spell using a key directly without having to place it in one of the spell bar’s slots.

8) Require Enemy: If this is the kind of spell that does damage to enemies and targeting enemies mode is enabled in the spell manager script then tick this option which will require the player to select an enemy before casting this spell. This way, the spell will move from the launch position directly to the enemy.

9) Spell Image: Child object of the spell book panel. Will display the spell’s icon.

10) Spell Description Text: Child object of the spell book panel. Will display the spell’s description.

11) Unlocking the spell: If the “Unlocked By Default” option is ticked then the spell will be available to cast. If not, then it will not be available to drag from the spell book to one of the spell bar slots only if the player reaches the amount required of “XP to Unlock” or the “Level to Unlock”.

Particle Effects:

Choose as much particle effects as you want for each spell and pick the order of initiating them when casting the spell by arranging them in the particle effects array:

1) Duration: Particle effect emission duration.

2) Delay: Delay time before emitting the particle effect.

3) Damage Value: If the spell is meant to do damage to enemies then pick a minimum and maximum damage value. And every time the spell is emitted, a random value between those two will be chosen as the spell’s damage value.

4) Damage Once: If ticked then spell will only do damage to the enemy the first time its particle effect enters in collision with the enemy. If not, the damage will be done every time a collision happens between the particle effect and the enemy.

5) Destroy On Damage: If this option is ticked, the spell’s particle effect will be immediately destroyed right after doing damage to an enemy.

6) Prefab: Particle Effect prefab.

7) Collision Particle: Pick the particle effect object/child objects that you want to do damage on collision with enemies. Make sure that these objects include the “World Particle Emitter” component. This is useful if the spell particle effect has few child objects that part of the particle effect and you don’t want some of these particle effect objects to do damage.

8) Prefab Destroy Time: Time needed to destroy the particle effect.

9) Launch Position: A game object representing the particle effect initial position.

10) Front Position: A game object that forms with the launch position object the direction of the movement of the particle effect (If it’s meant to be moving).

11) Particle Effect Movement:
– Move the spell by ticking the “Move” option and choosing the launch and front positions for the movement direction and the movement speed.
– Make the spell follow an object by ticking the “Follow” option and choosing the object to follow.
– Keep the spell in the same launch position by un-ticking the “Move” and “Follow” object.
– Enable casting spells directly at selected enemies by clicking on any enemy and the spell will move from the its launch position directly to the enemy by ticking the “Move” option and the “Require Enemy” option in the general settings and by choosing the movement speed.

Animation Effects: 

Play successive animation clips when casting a spell, pick a duration for each clip and synchronize them with creating particle effects. To play animations, you must select the object that holds the “Animation” component in the spell manager script to play the animation from (generally it’s the same as the player object).

Audio Effects:

Play successive audio clips when casting a spell and synchronize them with the animation and particle effects. You can also choose to loop the audio effect through out the chosen time. To play audio effects, you must select the object that holds an “Audio Source” component in the spell manager script.