Beach Platform on Unity
Hello everyone!
For the Unity class, I made my own Platformer Game, following Lea’s lessons and some Youtube tutorials.

Moving Platforms
First, I learn how to create a moving platform.

I created a platform, with a RigidBody and a Box Collider.
In order to make it move, I first used an animator, and defined its movement. However, even with a velocity script, my character could not move once he was on the platform.
I found another technique with a script, that I find easier to modify. Asyou can see below, I define how many points I want the platform to go to, then I enter their location and I define the speed, and the delay to go there. I found it is easier to modify the movement with this technique.
Once that the platform was moving, the issue was that my player was not moving with it. So I added a Triggered Box Collider to the platform. I made it a little taller than the platform, in order to be touched by the character on it. And Ta Da my character moves with the platform !

Slippering Floor and Bouncing Balls
Then, I made a slippery floor, using a physic material.

I lowered all its friction, and added it to my floor.
With the same technique, I created my bouncy balls.

Falling Chairs
Moreover, I added falling platforms, represented as chairs.

To do so, I created the platforms, added them 2 box colliders with one Triggered to interact with the player. I used the script below to make them fall (by being sensitive to gravity) if the player went on them, and added a delay, to make them only fall after 1 second.
The most difficult part was to respawn them after falling on the Death Wall.
I had to change the script of the Death Wall, and use a prefab to make it appear again. To make the prefab appear, I used “Instantiate” and a respawnPoint to define its position.
As you can see, for each falling chair there is a respawn point slot, but also a prefab ! Because to differenciate them in the code, I gave each one a tab : “Chair1”, “Chair2” and “Chair3”. This way I can make them reappear in different locations, with always the same tab (that is why I needed three prefabs).
Collectibles : Umbrellas
Furthermore, I added collectibles, represented as umbrellas. Once the player goes on them, they disappear.
The player also has to collect a fixed number of umbrellas to win. Therefore, the number of umbrellas collected is used for the wining platform and the win text. To do so, I created the empty object “Scene Manager” with the following script we saw in class :
In the script associated to the wining platform, I used the Platformer Scene Manager to verify the number of umbrellas collected :
And I used another script on the final platform to detect the player presence, and make the platform change its colors :

The Menu
Moreover, I added a Quit and Restart Button.
To do so, I created the two buttons. Their OnClick() functions are directed by the empty game object Menu and its script.
Timer
As you have seen, I added a Timer by creating a Timer Text, and controlling it from the Timer Script of the UI Game Object :
As you can see, the timer shows the time thanks to the parameter Time.deltaTime, and stops when the game is finished, so when the Victory Text is set to congratulations :

The Character’s Animation
Finally, I animated the character I made on Blender.
I used Mixamo to download 4 animations of my character : idle, walking, running, and jumping. I created an animator on my character, and used the Animator window to create my animation.
A blend tree is really useful, we need less code, and variables to animate the character. Indeed, I only needed at the end the speed and the direction variable.
Each rectangle represents a state. On the left, I defined the necessary parameters for the transitions. (Some are not used because they come from previous tests)
Of course, I still needed to modify my CharacterController.
The traps I fell in were to forget to activate the loop on my animations (in the downloaded animations), to modify the entries of my character controller, and to only activate the Exit Time after the jumps. (Because it is the only animations that needs to be finished, before starting another.)
I also put the camera in the hierarchy of my character, in order to follow the player when it moves. There is also the empty object Player, present in the hierarchy of the character in order to follow it. Since the camera is pointing the Player, we can easily control what we will see with the camera by moving the relative location of the Player.
Bonus :
To add a little life to my game, I used assets from free3d : beach balls, beach chairs, umbrellas, surfboards, Palm trees, sand material, and even a waterfall !