Move the camera up to follow the player evolution
We move the camera up as the player jumps higher and higher.
This Fsm expose a speed variable so that you can adjust how fast the camera is moving up. this is a very important setting, too fast, and the user loose concentration, too slow and you might beat the camera as you jump higher.
the moveUpTrigger is a child of the camera, which means as we the camera moves it moves too, We use this to detect that when the player is touching this trigger, which sends the "MOVE CAMERA UP" event: it's time to move the camera up ( the "LERP" state)
To move the camera up nicely, we use "LERP" a method that nicely and smoothly interpolates two values or vectors, if you'd use a linear translation, the camera work would not be very nice and pleasing. So this extra work of finding the distance, computing the vector target to lerp to, and the interpolation factor is very important from a gameplay point of view. In this case, we lerp the camera height against the player height, the camera is actually catching up with the player.
The behavior is slightly more complex than it seems. You'll note the "STOP" event and how it's fired, when the player position is below the trigger again. why? because we want to move the camera up as the player moves higher and higher, and when it starts to fall down again, we stop the camera work, which defines the game area where the user has to land on a platform ( all triggers are attached to the camera).
So to recap: As the user jumps, if it touch the trigger we follow the player jump with the camera until the player starts falling again.