Class Diagrams

Eye Tracking 2D

All information about the Eye Tracking 2D package can be found here.

Buttons

Buttons implement the IGazeableObject interface so that they can work with the EyeTracking2D package. The gazeAction() method calls the OnMouseDown() method so that both gaze and mouse input have the same result. Buttons have references to their own spriteRenderer to enable their colour to change as dwell time increases. The originalColor variable allows for the buttons's colour to be returned to normal once the user stops looking at the button. The abstract method OnMouseDown in the Button class is called when the button is clicked by the mouse and all subclasses override this method. All Button subclasses have references to either the GameManager class or the DockLevelGameManager class depending on the functionality of the button.

Pipes

Like the Button class, the Pipe class also implements the IGazeableObject interface so that it can work with the Eye Tracking 2D package. The gazeAction() method calls the OnMouseDown() method so that both gaze and mouse input lead to the same results. The colour of the pipe doesn't change when the pipe is being gazed at but, instead there is a sprite being rendered behind the pipe that glows. The SpriteRenderer for that sprite is stored in the backgroundSprite variable. The collectWater() method is used when water enters the pipe to ensure that water is travelling in the right direction - if it going out of the pipe, the water droplet is ignored and false is returned. This is determined by the correctDirection() method. The spawnLocation variable is either 'head' or 'tail' which refers to which end of the pipe the water is flowing out of. This is used by the correctDirection() method. The releaseMessageBottle() method is called in a separate coroutine when the bottle carrying the message enters the pipe.

GameManager

The GameManager class acts as a controller for the game. This class is used in the 'maze' levels. It has references to all of the important parts of the game such as the currently selected Pipe. It handles communication between different GameObjects and holds the current state of the game. Most of the buttons in the levels call a public method within the GameManager script. The SelectionBox is a box used to signify which pipe is currently selected and this object is moved by the GameManager when necessary. The buttonManager variable is used to activate and deactivate the appropriate buttons when necessary. For example, when water is running, the rotation buttons are disabled as the pipes should not be able to be rotated whilst the water is running. The DockLevelGameManger is a subclass of the GameManager and extends some of the functionality of the original GameManger class in order to support the additional parts of the 'normal' level such as the dock and the ability to move pipes on the grid.

Dock

The Dock has references to the different types of pipes available on the dock. This is used to instantiate the new pipe GameObjects when the user moves a pipe from the dock to the grid. It also updates the text that displays the number of each type of pipe that is remaining. The PipeTypes enum is used in the dictionary that holds information about how many of each type of pipe are remaining on the dock.