Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StreetSystem

Computes and renders the streets

Hierarchy

Index

Constructors

constructor

Methods

addRouterConnections

  • addRouterConnections(router: any): void
  • Adds all connections from the given entity, assumes that the entity has a route cache component. Affects all emitters

    Parameters

    • router: any

    Returns void

computeChunkNeedsRedraw

  • computeChunkNeedsRedraw(chunk: any, oldData: any, newData: any): boolean
  • Computes if the street data within a given chunk changed and thus the chunk needs to get redrawn

    Parameters

    • chunk: any
    • oldData: any
    • newData: any

    Returns boolean

draw

  • draw(parameters: any): void
  • Override, do not call this directly, use startDraw()

    Parameters

    • parameters: any

    Returns void

getStreetFlags

  • getStreetFlags(x: any, y: any): number
  • Returns the street flags at the given street space point. Does not check the coordinates!

    Parameters

    • x: any

      Street-space x

    • y: any

      Street-space y

    Returns number

isStreetAt

  • isStreetAt(streetSpacePoint: any): boolean
  • Returns if there is a street at the given street space point. Street Space is Tile Space * 2, since every tile is split into two street parts.

    Parameters

    • streetSpacePoint: any

    Returns boolean

makeEmptyGrid

  • makeEmptyGrid(context?: any): any[]
  • Internal method to create a new empty street grid

    Parameters

    • Default value context: any = null

      optional context for memory tracking

    Returns any[]

onGameLoaded

  • onGameLoaded(): void
  • Internal game load handler

    Returns void

onStructureDestroyed

  • onStructureDestroyed(): void
  • Internal structure destroyed handler

    Returns void

onStructurePlaced

  • onStructurePlaced(): void
  • Internal structure placed handler

    Returns void

placeStreetBetween

  • placeStreetBetween(p1: any, p2: any): void
  • Internal helper to place a street between two points

    Parameters

    • p1: any
    • p2: any

    Returns void

placeStreetsOnPath

  • placeStreetsOnPath(pathStreetSpace: any): void
  • Helper method to already place streets before actually computing the network. This is used during initialization, since the order is: Place all buildings -> Recompute streets. So before all buildings are placed, no street data would be available at all. However, because we are computing streets during that time already, we incrementally build up the streets already with this method, so the street path finder has data to use

    Parameters

    • pathStreetSpace: any

    Returns void

recomputeStreetNetwork

  • recomputeStreetNetwork(): void
  • Recomputes the street network

    Returns void

redrawChunk

  • redrawChunk(chunk: any): void
  • Redraws a street chunk

    Parameters

    • chunk: any

    Returns void

startDraw

  • startDraw(parameters: any): void
  • see

    GameSystem.draw Wrapper arround the draw method

    Parameters

    • parameters: any

    Returns void

update

  • update(): void
  • Updates the streets in case they needs a recompute

    Returns void