Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UpgradesComponent

Allows an entity to perform upgrades to itself. Most Buildings have this. Upgrades are behaviour-changing changes to the entity, e.g. a new resource produced or transforming into a new type of tower. In comparison to enhancements, upgrades do much more, but they are also limited (Most buildings only have 5 upgrades or so, if at all, whereas Enhancements can be leveled up to level 512). However, upgrades provide cooler features which gives them their place.

Hierarchy

Index

Constructors

constructor

Methods

checkCanUnlock

  • checkCanUnlock(id: any): boolean
  • Checks if its possible to unlock the given upgrade. This does not check requirements like the cost, but it checks if the upgrade is available in the current upgrade path and such

    Parameters

    • id: any

    Returns boolean

deserialize

  • deserialize(data: any): any

getDebugString

  • getDebugString(): string

getFurthestUpgradeSpriteId

  • getFurthestUpgradeSpriteId(): any
  • Checks the last upgrade which has the newSpriteId property in order to return the rendering sprite id

    Returns any

getNextUpgrades

  • getNextUpgrades(): any[]
  • Returns the next upgrades

    typedef

    {({ upgrade: Upgrade, pathClosed: boolean, last:boolean, localIndex: number, localMax: number })} NextUpgradeResult

    Returns any[]

getUpgradeById

  • getUpgradeById(id: any): any
  • Returns an upgrade handle by id

    Parameters

    • id: any

    Returns any

internalDoUnlock

  • internalDoUnlock(id: any): boolean
  • Internal unlock method for upgrades

    Parameters

    • id: any

    Returns boolean

internalInitializeUpgrades

  • internalInitializeUpgrades(): void
  • Internal helper to initialize the list of upgrades

    Returns void

isPathClosed

  • isPathClosed(upgrade: any): boolean
  • Checks if the upgrade path for the given upgrade is locked, that is, if you upgrade something from path A, you can not unlock something from path B anymore

    Parameters

    • upgrade: any

    Returns boolean

isUnlocked

  • isUnlocked(id: any): boolean
  • Returns if an upgrade is already unlocked

    Parameters

    • id: any

    Returns boolean

serialize

  • serialize(): object

Static getCachedSchema

  • getCachedSchema(): any

Static getId

  • getId(): string
  • Returns string

Static getSchema

  • getSchema(): object

Static verify

  • verify(data: any): string