The Magic Item Action is an extremely flexible Item Action which allows the item to perform a wide variety of magic and spell related actions. The Magic Item relies on sub-actions to perform the actual work: BeginActions, CastActions, ImpactActions, and EndActions. Using the sub-actions the Magic Item can spawn particles, objects, surface effects, audio, etc. New actions can be created by implementing the base class.
Begin Actions starting playing at the start of the item use until the Use event is sent.When the Use event occurs the Cast Action will trigger. For Single Use Type Magic Items the End Actions will start playing immediately after the Use event occurs. Continuous Use Type Magic Items will start playing the End Action when the Magic Item is starting to be stopped. Both actions will stop when the item is no longer being used.
Begin and End Actions implement the same base class so the same object can be used for either the start or end of the Magic Item use. These actions allow for starting or ending effects effects, such as starting to fade the character before a teleport or spawn a local particle system that should occur after the actual cast.
Fades the materials on the character.
Play Audio Clip
Plays an audio clip.
Spawns a particle.
Cast Actions are the primary sub-action within the Magic Item. Cast Actions occur when the Use event is sent and is the main visual that you see for the Magic Item. Common cast actions include spawning a particle, but other cast actions can spawn any arbitrary object or start an effect on the character.
When a Cast Action collides with an object it can start an Impact Action. This allows for effects to be played at the impact location.
Uses the physics system to determine the impacted object.
Play Audio Clip
Plays an audio clip when the cast is performed.
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.
Immediately calls impact on the object at the target position.
Teleports the character.
Impact Actions play an effect at the location determined by the Cast Action. Frequent Impact Actions will be to spawn a particle or change an Attribute value.
Adds a force to the impacted object.
Adds a torque to the impacted object.
Damages the impacted object.
Heals the impacted object.
Modifies the specified attribute on the impacted object.
Play Audio Clip
Plays an AudioClip on the impacted object.
The Ricochet action will cast a new CastAction for nearby objects, creating a ricochet effect.
Spawns a ParticleSystem upon impact.
Spawn Surface Effect
Spawns a SurfaceEffect upon impact. The SurfaceImpact object is specified on the MagicItem.
When a Cast Action effect plays it can collide with other objects to play an Impact Action. This collision can occurs with one of the following methods:
Unity’s Particle System has the option of sending collision messages when the particle collides with another object. In order for the collision message to be received the Magic Particle component must be added to the Particle System that can cause the collision.
If the Physics Cast Cast Action is used then a raycast will be performed when the Cast Action is run. This raycast will execute the Impact Actions immediately.
Is the character required to be on the ground?
The direction of the cast.
- None: The cast has no movement.
- Forward: The cast should move in the forward direction.
- Target: The cast should move towards a target.
- Indicate: The cast should move towards an indicated position.
Use Look Source
Should the look source be used when determining the cast direction?
The maximum distance of the movement cast direction.
The radius of the movement cast direction.
The layers that the movement directions can collide with.
The maximum angle that the target object can be compared to the character’s forward direction.
Max Collision Count
The maximum number of colliders that can be detected by the target cast.
The number of objects that a single cast should cast.
The transform used to indicate the surface. Can be null.
Surface Indicator Offset
The offset when positioning the surface indicator.
Specifies how often the cast is used.
- Single: The cast should occur once per use.
- Continuous: The cast should occur ever use update.
Min Continuous Use Duration
The minimum duration of the continuous use type. If a value of -1 is set then the item will be stopped when the stop is requested.
Should the continuous use type cast every update?
The amount of the ItemIdentifier that should be used each cast.
Specifies when the cast should be interrupted.
- Movement: The cast should be interrupted when the character moves.
- Damage: The cast should be interrupted when the character takes damage.
The SurfaceImpact of the cast.
Can Stop Substate Index Addition
The value to add to the Item Substate Index when the item can stop.