Player.cs

MonoBehaviour script, Player, is responsible for handling player input and interacting with the GameManager and LevelHandler classes in the game. The purpose of this script is to enable player controls for moving and rotating pipe tiles, as well as starting the flow within the pipe system.

The following controls are supported:

The Player class has two private fields:

In the Start() method, the references to the GameManager and LevelHandler are initialized.

The Update() method checks for player input and calls the corresponding methods of the LevelHandler and GameManager classes:

levelHandler.MoveActiveTileUp();
levelHandler.MoveActiveTileDown();
levelHandler.MoveActiveTileRight();
levelHandler.MoveActiveTileLeft();
levelHandler.RotateActiveTile();
gm.StartFlow();

These method calls are wrapped in a conditional statement, ensuring that player input is only processed if the game is not paused and has not ended (checked using PauseControl.GameIsPaused and GUIHandler.IsEndGame).