Magic Time for Projectile Factory

v1.0

The projectile (and characters) pass through a "Time Scale Zone", slowing them down.

Turn Projectiles into Magic Time Users

Add the MagicTimeProjectile component to your Projectile objects. This class inherits from MagicTimeUser and has all the methods that brings.

Here, we see the Projectile will subscribe to the "Global" LocalTimeScale. It will also have it's own LocalTimeScale.

You can always create a new class which inherits from MagicTimeProjectile if you'd like to add any custom logic for your project, including any interactions with custom Behaviors you may have created.

This is a custom class which inherits from MagicTimeProjectile. It has additional logic allowing the projectile to subscribe to additional LocalTimeScale objects, in this case depending on whether it is an "Enemy" or "Player" projectile.

Set Up Projectile Data

Each Projectile has a ProjectileData object on it, which can be customized. This also has the "speed" value for the Projectile. The integration comes with MagicTimeProjectileData which will calculate speed using the value set modified by the Magic Time values.

Create a new Projectile Data object of this type by right-clicking in your project and choosing Create/Projectile Factory/Projectile Data/Projectile Data for Magic Time

Be sure to set the values you'd like, and then populate your Projectiles with this Projectile Data object.

Add Additional Components

Your Projectiles may have many different types of components on them -- they probably have a ParticleSystem, but they may also have audio, lighting, or other systems. You can add additional components to your Projectile object which handle the time / speed management of these various components.

Magic Time User Destroy Or Pool Object

The original DestroyOrPoolObject component will send an object back to the pool after a set amount of time. The new version, MagicTimeUserDestroyOrPoolObject will do the same thing, but will take into account the objects TimeScale, so that it doesn't get destroyed too soon.

Magic Time User Particle System

The MagicTimeParticleSystem component will gather all ParticleSystems that are on this Projectile, and set their simulation speed to match the CombinedValue() of the GameTimeUser object. This way as the object speeds up and slows down, the particle system effects will as well.

Magic Time User Trail Renderer

Add the MagicTimeUserTrailRenderer component to handle any TrailRenderer components on the projectile.

Magic Time User Audio Source

Add the MagicTimeUserAudioSource component to automatically adjust the pitch of audio clips on the Audio Source. This will cache the starting pitch values, so should really be used only for Audio Sources that do not have dynamic clips.

There is also a MagicTimeUserAudioMixer component, which you can add on your Audio Mixer, and assign the MagicTimeUser value to the user you'd like. Generally this would NOT be a single projectile!

Last updated

Was this helpful?