Behavior Class

From Heroes of Hammerwatch wiki
Jump to: navigation, search

Behavior classes can be any class referenced from a unit's behavior tag.

Objects are constructed using this constructor:

ClassName(UnitPtr unit, SValue& params)

Methods called from the engine

The engine calls the following functions, if they exist:

  • void Update(int dt)
  • void QueuedPathfind(array<vec2>@ path)
  • void QueuedFetchActors(array<UnitPtr>@ actors)
  • void Collide(UnitPtr unit, vec2 pos, vec2 normal)
  • void Collide(UnitPtr unit, vec2 pos, vec2 normal, Fixture@ fxSelf, Fixture@ fxOther)
  • void EndCollision(UnitPtr unit)
  • void EndCollision(UnitPtr unit, Fixture@ fxSelf, Fixture@ fxOther)
  • void Destroyed()
  • vec4 GetOverlayColor()
  • SValue@ Save()
  • void Load(SValue@ save)
  • void PostLoad(SValue@ save)