Difference between revisions of "Bubble Shooter Kit Code structure"

From gamevanilla wiki
Jump to: navigation, search
(Base UI classes)
(Base UI classes)
Line 24: Line 24:
 
* '''AnimatedButton:''' A special button that provides a custom animation and click behaviour.
 
* '''AnimatedButton:''' A special button that provides a custom animation and click behaviour.
 
* '''BaseScreen:''' The base class all screens in the game (home, map and game) derive from.
 
* '''BaseScreen:''' The base class all screens in the game (home, map and game) derive from.
* '''ScreenTransition:''' A utility component that provides a fade-to-color style of transition into a new Unity scene.
+
* '''ScreenTransition:''' A utility component that provides a smooth, fade-to-color style of transition into a new Unity scene.
  
 
= Editor =
 
= Editor =

Revision as of 08:22, 22 October 2021

Code structure

The code of the kit lives in the BubbleShooterKit/Scripts folder of the project. This folder is further subdivided into three sub-folders:

  • Common: Contains all the game-agnostic code of the kit.
  • Editor: Contains all the editor code of the kit.
  • Game: Contains all the game-related code of the kit.

Common

The Common folder contains all the game-agnostic code of the kit. This is the foundational code that is used across the kit and is not specifically tied to any gameplay logic (i.e., can be reused across different projects). We are going to discuss the most important pieces next.

Object pool

Pooling is used for every short-lived, dynamically-instantiated object in the game (e.g., bubbles, particles, sound effects) in order to improve the runtime performance of the game. The relevant script is ObjectPool, which comes accompanied by the utility script AutoKillPooled that allows to automatically destroy the attached object after a specified time interval.

Base UI classes

The kit provides several useful abstractions on top of Unity's built-in UI system that are used in many places in the game:

  • AnimatedButton: A special button that provides a custom animation and click behaviour.
  • BaseScreen: The base class all screens in the game (home, map and game) derive from.
  • ScreenTransition: A utility component that provides a smooth, fade-to-color style of transition into a new Unity scene.

Editor

The Editor folder contains all the editor code of the kit.

Game

The Game folder contains all the game-related code of the kit.