DoopelPonger
|
Event based effect to shake the camera to make impacts look more intense. More...
Public Member Functions | |
void | Awake () |
Register the event listener for the camera shake event. More... | |
void | FixedUpdate () |
Move/rotate the camera based on the current intensity value. More... | |
Public Attributes | |
float | intensityDecayRate |
float | maxShake |
float | maxRotation |
float | timingMultiplier |
Event based effect to shake the camera to make impacts look more intense.
The camera shake works by having an intensity meter that goes from 0 to 1, where 1 is max screen shake. It also uses Perlin Noise to get a value for a rotational and position offset. It then takes the offsets multiplied by the intensity squared to compute the actual amount of shake to the screen. There are two types of screen shakes that can be triggered, compounding and noncompounding. A compounding shake makes it so that consecutive shake events can add together to make a bigger shake, for example two shakes of intensity .2 can increase the intensity to .4. A noncompounding shake makes it so two consecutive shakes cannot add up to a greater shake. So two .2 intensity shakes will not increase the intensity to .4 but instead stay at .2.
void CameraShake.Awake | ( | ) |
Register the event listener for the camera shake event.
void CameraShake.FixedUpdate | ( | ) |
Move/rotate the camera based on the current intensity value.
float CameraShake.intensityDecayRate |
How fast the intensity should decrease from 1 to 0.
float CameraShake.maxRotation |
Max rotational offset multiplier.
float CameraShake.maxShake |
Max positional offset multiplier.
float CameraShake.timingMultiplier |
How fast the x axis should move in the Perlin Noise Generator.