The MagicAction component is used to create items that can cast spells. It is the most flexible of the ItemActions but also the most complex.
The Module groups for the MagicActions are
- Trigger [S]: Simple, repeat or burst are usually used.
- Usable [M]: For any module shared between an UsableItemAction.
- Caster [S]: The main magic module will control how the spell is cast.
- Begin [M] : Start and stop effects while beginning the magic cast.
- Cast Effect [M]: The effects of casting.
- Impact [M]: The impact action. Some cast effects invoke collisions that can impact.
- End [M]: Start and stop some effects at the end of the cast.
- Extra [M]: Any other modules that are specific to magic but does not fit in any other group.
Groups noted as ‘[M]’ can have many modules active at once. Usually all the enabled modules are considered active.
The Caster modules are used to casting the Cast Effects.
The MagicCastData contains the following properties
- Cast Origin: The Transform where the cast should originate from.
- Cast Position: The point where the cast should fired.
- Direction: The direction in which the cast will be fired.
- Cast Target Position: The position of the target.
- Initial Start Cast Time: The first cast start time since start use.
- Start Cast Time: The last cast start time since start use.
- Target Index: The index of the target.
- Targets: List of targets.
- Cast ID: The ID of the cast to differentiate it if the cast loops.
- Cast Normal: The normal vector of the cast target.
- Detect Layers: The LayerMask of the layers that should be detected.
A caster module with basic functionality. The caster module is used to detect the targets initiate all the casting effects.
Begin & End
The Begin and End module groups share the same type of MagicStartStopModule.
These are modules that have a Start, Update and Stop function.
Generic Item Effects
Invokes Generic Item Effects on start and/or stop.
Fades the materials on the character.
Play Audio Clip
Start and stop an AudioClip, perfect for AudioClips that need to loop until they should be stopped.
Spawn particles. This is perfect for particles that need to loop until they should be stopped.
Enable or disable a GameObject between start and stop.
Cast effects can start and complete. It differs from StartStop modules because the caster knows when the cast has completed by checking that the cast effects are done.
Do a Raycast, SphereCast or OverlapSphere to detect targets to impact.
Play Audio Clip
Play audio while casting.
Spawns an object when the cast is performed.
Spawns a particle when the cast is performed.
Spawns a projectile when the cast is performed.
Starts an effect on the character.
Impact the caster target.
Teleports the character.
Cast Item Effects
Invokes Item Effects from an ItemEffectGroup.
Magic Cast Effect Nester
Repeat certain cast effects in a loop0
Invoke functions when the a cast impacts a target.
Generic Shootable Impact Module
Invoke Impact Action Group
The Ricochet action will cast a new CastAction for nearby objects, creating a ricochet effect.