Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FogSystem

Renders the fog and keeps track of explored / unexplored tiles

Hierarchy

Index

Constructors

constructor

Methods

cleanup

  • cleanup(): void
  • Cleans up all temporary canvases

    Returns void

draw

  • draw(parameters: any): void
  • Parameters

    • parameters: any

    Returns void

getCurrentAlphaTarget

  • getCurrentAlphaTarget(): number
  • Returns number

initTileArrays

  • initTileArrays(): void
  • Initializes the tile vision and explore state 2D arrays, called the first time the fog is recomputed

    Returns void

internalDrawWorldSpriteToRenderBuffer

  • internalDrawWorldSpriteToRenderBuffer(sprite: any, padding: any, offset: any): void
  • Parameters

    • sprite: any
    • padding: any
    • offset: any

    Returns void

makeBlurredCircleSprite

  • makeBlurredCircleSprite(): void
  • Initializes the circle used for rendering the negative parts of the fog (The vision ones)

    Returns void

makeBufferCanvas

  • makeBufferCanvas(): void
  • Creates the buffer canvas which is used to pre-draw the fog This saves us a lot of fill rate during the main rendering.

    Returns void

makeRenderCanvas

  • makeRenderCanvas(): void
  • Creates the rendering canvas, which is used to draw the fog on the main screen: It always has the same size as the screen and is used as a seperate layer

    Returns void

onGameRestored

  • onGameRestored(): void
  • Returns void

onStructureChanged

  • onStructureChanged(entity: any): void
  • Callback which redraws the fog if a structure got destroyed or placed

    Parameters

    • entity: any

    Returns void

recomputeFogCache

  • recomputeFogCache(force?: boolean): void
  • Redraws the fog and also computes which tiles are explored and which not, used by the game logic

    Parameters

    • Default value force: boolean = false

    Returns void

resetTileArrays

  • resetTileArrays(): void
  • Resets all tile arrays without recreating them

    Returns void

startDraw

  • startDraw(parameters: any): void
  • see

    GameSystem.draw Wrapper arround the draw method

    Parameters

    • parameters: any

    Returns void

update

  • update(): void
  • Recomputes the cache if it hasn't been computed yet

    Returns void