I worked on this game over the course of two months in a team with one other programmer. This game focuses on a couch co-op experience in which two players, playing as a brother-sister duo, work together to guide ships through the rocky seas at night. The players control the light similar to how an Etch A Sketch with one player controlling one axis of movement while the other controls the other.
As well as creating my own scripts with a focus on the functionality of the ships, I assisted in revising and debugging most of the scripts that went into the game. I also worked on some other functionality, such as needing to keep the fire lit by supplying it with wood every so often. However, it was decided these features needed to be cut due to time constraints.
This script is fairly simple. The "light" that the players are controlling is actually an object moving along the water. After spawning in, the ships will find this object in the scene and constantly adjust their angle to face the "light" while always moving forward. There was also some extra functionality for the fire fuel system, where the ship would stop angling towards the "light" when the fire went out. As you can see, I also used a tweening package called DOTween. This allows for quick and easy tweening and is very flexible with a large library of pre-made movement options.
This script was also simple to create and was built on over time. When the ship collides with an object, it checks what the object is. If it's a rock, it will lose one health and if its health falls to zero, add to the count of dead passengers. If the object is the safe zone, then it adds to the ships saved counter. Using the tag checking system allowed for scaling and modularity in the future. Rather than adding a separate check for each type of object, we can name every hazard "Rock" and the ship would take damage upon hitting any of them.
When working in teams, I will often add tooltips to the exposed variables in my scripts. This allows others trying to use/edit my script to do so with a better understanding of what the different values affect.
The source of light for the lantern in this game is a large fire and as such, it would need to remain fuelled so it doesn't go out. While the particle effect is running, a timer will tick down. Players adding wood to the fire will increase the timer again. When the fire runs out, it will deactivate the fire effect. Once the fire is out, it then runs a different check to see if it has been given more fuel, at which time it will light and start burning again.
The players were able to take wood from the woodpile and carry it over to the fire. The whole interaction is handled by the fire and wood, with the player simply getting shown to hold the wood when they pick it up. There is a bool in the wood pile that handles if the player is actually holding a piece of wood and each object handles what happens when a player interacts with them, swapping the bool back and forth as needed.
Here is the script for the wood storage, showcasing the other side of the wood handling.