State Handler

Description

The State Handler is the component in FP Motion that checks all the events that the player is triggering and decides on the player's state based on them.

Once it decides on a state, it collects the State Data from it and passes it to the components in the asset that need it via events.

How does it work?

The State Handler has two important methods, the GetCameraState, and GetWeaponState methods, these two calculate what state the player is in based on information gotten from events.

Both of them return the same state, but different State Data, this allows you to have different information for cameras and guns, or other objects in the game based on the state.

Usage

When in need to grab the current state data from the handler, you can use the following code:

//Is weapon can be true or false.
PlayerStateHandler.Instance.GetState(isWeapon);

In version 2.0 the state data will be easily accessible trough events.

Last updated