DoopelPonger
Public Member Functions | Public Attributes | List of all members
CameraShake Class Reference

Event based effect to shake the camera to make impacts look more intense. More...

Inheritance diagram for CameraShake:
Inheritance graph
[legend]
Collaboration diagram for CameraShake:
Collaboration graph
[legend]

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
 

Detailed Description

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.

Member Function Documentation

◆ Awake()

void CameraShake.Awake ( )

Register the event listener for the camera shake event.

◆ FixedUpdate()

void CameraShake.FixedUpdate ( )

Move/rotate the camera based on the current intensity value.

Member Data Documentation

◆ intensityDecayRate

float CameraShake.intensityDecayRate

How fast the intensity should decrease from 1 to 0.

◆ maxRotation

float CameraShake.maxRotation

Max rotational offset multiplier.

◆ maxShake

float CameraShake.maxShake

Max positional offset multiplier.

◆ timingMultiplier

float CameraShake.timingMultiplier

How fast the x axis should move in the Perlin Noise Generator.


The documentation for this class was generated from the following file: