Software - Unity, C#
Team size - 3 game developers, 1 game artist, 2 musicians
Duration - 5th August - 14th August
References: Links to the CharacterController, a ground check Transform, and a LayerMask to detect the ground.
Settings: Adjustable parameters for walking speed, running speed, gravity, and ground detection distance.
Core Functions:
SetInput() – Reads player input from the keyboard (WASD or arrow keys).
ApplyGravity() – Applies gravity and checks if the player is grounded.
ApplyRunning() – Switches between walking and running speeds when Left Shift is held.
SetMoveDirection() – Moves the player in the desired direction using the CharacterController.
Fields:
mouseSensitivity – Controls how responsive the camera is to mouse movement.
playerBody – Reference to the player’s Transform (used for horizontal rotation).
xRotation – Tracks vertical camera rotation to prevent over-rotation.
Start() – Locks the cursor to the screen center for immersive control.
Update() – Each frame:
Reads mouse movement via SetMousePosition().
Rotates the camera and player accordingly via RotateCameraAndPlayer().
RotateCameraAndPlayer() –
Tilts the camera up/down (vertical look).
Rotates the player left/right (horizontal look).
Clamps vertical rotation between -90° and +90° to avoid flipping.
IPickupCollectable (Interface)
Declares a single method: Pickup(), which defines what happens when something is collected.
Collectable (Class)
Implements IPickupCollectable.
Has a UnityEvent (onCollectibleCollected) that can trigger custom actions (like sound, score, effects) when collected.
When Pickup() is called:
Invokes the event.
Destroys the collectible object.
Pickup (Class)
Detects when another collider enters its trigger zone.
If the entering object implements IPickupCollectable, it calls its Pickup() method.
Purpose:
Makes on-screen warning text smoothly fade in and out (flash) when enabled.
Fields:
CommentminAlpha, CommentmaxAlpha – Minimum and maximum alpha (transparency) values.
CommentCurrentAlpha – Current alpha value of the text.
flashingSpeed – Speed of fading (very small for smooth effect).
isAllowedToflash – Toggles whether the text is flashing or fading out.
text – Reference to the TextMeshPro text component.
_currentAlphaValue – Tracks if the text is currently growing (fading in) or shrinking (fading out).
Core Methods:
Start() – Initializes alpha values and sets starting fade direction.
Update() –
If flashing is enabled, smoothly cycles alpha between min and max.
If not, gradually fades out to invisible.
SetIsAllowedToFlash(bool) – Enables or disables the flashing behavior externally.
alphaComments() – Handles the continuous fade-in/fade-out cycle.
ShrinkAlpha() – Gradually hides the text when flashing is disabled.
Purpose:
Lets players adjust and save the game’s master volume via a UI slider.
Fields:
volumeSlider – The UI slider controlling the volume.
volumeTextUI – A text element displaying the current volume value.
Core Methods:
Start() –
Registers a listener for slider changes.
Loads the saved volume setting at startup.
VolumeSliderController(float volume) – Updates the on-screen volume text (though it uses an incorrect format string "100.0"; should likely be "0.0" or "F2").
SaveVolume(float volume) –
Saves the current slider value to PlayerPrefs.
Calls LoadVolume() to apply it immediately.
LoadVolume()–
Retrieves the saved volume from PlayerPrefs.
Updates the slider and sets the global AudioListener.volume.
Purpose:
Provides a UI control to change the camera’s mouse sensitivity in real time.
Fields:
sensitivitySlider – The UI slider that adjusts sensitivity.
sensitivityValueText – Displays the current sensitivity value (not yet used in the script).
sensitivity – The initial sensitivity value.
cameraController – Reference to the player’s CameraController script that actually uses the sensitivity.
Core Methods:
Start() –
Sets the slider’s initial value.
Registers a listener to handle value changes.
ChangeSensitivity(float newSensitivity) –
Updates the mouseSensitivity value in the CameraController when the slider changes.
Purpose:
Checks for collisions with a ceiling using a raycast shot upward.
Fields:
raycastLength – The maximum distance the raycast checks for a ceiling.
ceilingLayer – Specifies which layers count as ceilings.
IsTouchingCeiling – Public read-only property indicating whether a ceiling is detected.
Core Logic:
Update() – Each frame, casts a ray upward (Vector3.up) from the object’s position.
If the ray hits something within raycastLength on the specified ceilingLayer, IsTouchingCeiling becomes true; otherwise, it’s false.