Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GameCore

The core manages the root and represents the whole game. It wraps the root, since the root class is just a data holder.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • app: any

    Returns GameCore

Methods

destruct

  • destruct(): void
  • Destructs the root, freeing all resources

    Returns void

draw

  • draw(): void
  • Returns void

initExistingGame

  • initExistingGame(): boolean
  • Inits an existing game by loading the raw savegame data and deserializing it. Also runs basic validity checks.

    Returns boolean

initNewGame

  • initNewGame(): void
  • Initializes a new game, this means creating a new map and centering on the plaerbase

    Returns void

initRenderLayers

  • initRenderLayers(): void
  • Initializes the render layers. Those are the cached layers for streets and thus

    Returns void

initializeRoot

  • initializeRoot(parentState: any, savegame: any): void
  • Initializes the root object which stores all game related data. The state is required as a back reference (used sometimes)

    Parameters

    • parentState: any
    • savegame: any

    Returns void

interfaceInitFactions

  • interfaceInitFactions(): void
  • Should initialize all factions

    Returns void

interfaceMakeActionManager

interfaceMakeGameRoot

  • Overrideable interface

    Returns GameRoot

interfaceMakeGameTime

  • Overrideable interface

    Returns GameTime

interfaceMakeWaveManager

  • Overrideable interface

    Returns WaveManager

internalInitCanvas

  • internalInitCanvas(): void
  • Initializes the render canvas

    Returns void

internalInitDifficulty

  • internalInitDifficulty(difficulty: any): void
  • Initializes the difficulty. Based on the difficulty we also compute a new balancing object.

    Parameters

    • difficulty: any

    Returns void

internalInitMapLayout

  • internalInitMapLayout(layout: any): void
  • Initializes the map layout. This is a bit hackish since it overrides the global globalConfig.numTiles(X|Y) and such. However, passing those to all classes etc is also a bit annoying.

    Parameters

    • layout: any

    Returns void

internalInitMatchmode

  • internalInitMatchmode(matchmode: any): void
  • Initializes the matchmode, also inits the factions

    Parameters

    • matchmode: any

    Returns void

onMapThemeLoaded

  • onMapThemeLoaded(): void
  • Handler when the map theme was finally loaded

    Returns void

postLoadHook

  • postLoadHook(): void
  • Returns void

prepareGameOver

  • prepareGameOver(): void
  • Prepares the game to get gameover on next frame

    Returns void

redrawBackgroundLayer

  • redrawBackgroundLayer(chunk: any): Rectangle
  • Redraws the background layer

    Parameters

    • chunk: any

    Returns Rectangle

requireRoutingUpdate

  • requireRoutingUpdate(): void
  • Returns void

resize

  • resize(w: any, h: any): void
  • Parameters

    • w: any
    • h: any

    Returns void

shouldRender

  • shouldRender(): boolean
  • Returns boolean

switchInteractionMode

  • switchInteractionMode(mode: any): void
  • Switches into the given interaction mode

    Parameters

    • mode: any

    Returns void

tick

  • tick(deltaMs: any): boolean
  • Parameters

    • deltaMs: any

    Returns boolean

updateLogic

  • updateLogic(): boolean
  • Returns boolean