import { Game2D } from '../core/2d'; import { Game3D } from '../core/3d'; import { StateConfig } from './state.config'; /** * Abstract class representing a State, broken down into concrete 2D and 3D variants in State2D and State3D * * A State is roughly equivalent to a Scene; a literal distinct *state* that the game can be in * * Example States may include Menu, Game, Pause, Dead, etc * * The typeparam specifies which concrete Game type the State belongs to, allowing for the concrete State2D and State3D to receive a * type-correct Game instance in their lifecycle methods, and enabling the assurance that a Game is only configured with the corresponding * 2D or 3D State type * * @typeparam TGame the concrete Game Type the State belongs to */ export declare abstract class State { protected readonly config: StateConfig; /** * Constructor. Take and store the State's config * * @param config the State's configuration */ constructor(config: StateConfig); /** * Getter for the State's name, as provided in its Config * * @returns the State's name */ get name(): string; /** * Generic init lifecycle method, calling down to the init() provided in the State's config * * Called when the State is switched to, facilitating State initialisation * * @param game the game the State is running within */ init(game: TGame): void; /** * Generic tick lifecycle method, calling down to the tick() provided in the State's config * * Called once per frame as an update routine, facilitating State frame logic * * @param game the game the State is running within * @param frameDelta the Game's frameDelta for normalizing time-dependent operations */ tick(game: TGame, frameDelta: number): void; /** * Generic end lifecycle method, calling down to the end() provided in the State's config * * Called when the State is switched away from, facilitating State cleanup * * @param game the game the State is running within */ end(game: TGame): void; }