My Code


Game loop:

There are two special scenes. PersistentObjectsLoadScene is loaded at the startup, then there is the MainMenu scene.

The main menu is an isolated part of the code, which is managed by MainMenuManager. It displays available levels which are defined as LevelParameters ScriptableObjects.

The gameplay is much more complicated.

Each level is a separate scene like Level_1.

When a level is started, first of all a persistent manager called LevelPersistence is requested to load the level, which replaces the initial level state with the loaded state.

For ui there is GameplayUIManager which provides an abstraction over the gameplay UI. If the player is on android TouchControls is initiated to make on-screen controls work. Additional manager clasess are ViewmodelManager which enables gun view model display, PauseMenuManager which allow pause menu logic.

The player prefab is divided into many classes and components:

  • PlayerController - main component
  • MovementComponent - movement
  • PlayerSaveComponent - saving the player state
  • UseComponent - use key mechanics
  • WeaponSystemComponent - general weapon handling
  • RevolverComponent - revolver mechanics
  • RevolverInventorySystem - the inventory system behaviour, which informs UI of what should be displayed

The enemy prefab is divided into a main component EnemyBotController and a visual component BotDisplayComponent. The AI is represented by a state machine, where each state is an instance implementing IState.

Key MonoBehaviours:

The class I am proudest of is LevelPersistence.cs, because it is the top of the save load system but is so simple nonetheless.

MainMenuManager.cs would be the class to receive the complete overhaul, it’s just a bunch of hardcoded ugly stuff to make the main menu work.

Files

RootinTooter_win64.zip 63 MB
Feb 16, 2025
RootinTooter_android.apk 81 MB
Feb 16, 2025

Get Rootin' Tooter