UnitPtr class
References a unit in the scene.
Operators
- auto operator==(const UnitPtr&) -> bool
Callbacks
- auto RegisterEventCallback(UnitEventType event, uint32 filter, ref script, string func) -> UnitEventCallbackId
- void TriggerCallbacks(UnitEventType event, uint32 filter, SValue* args = null)
- auto RegisterEventCallback(UnitEventType event, ref script, string func) -> UnitEventCallbackId
- void UnregisterEventCallback(UnitEventCallbackId id)
- auto HasCallbacks(UnitEventType event) -> bool
- void TriggerCallbacks(UnitEventType event, SValue* args = null)
Classification
- void TagAsDebris(uint8 importance)
- auto IsLight() -> bool
- auto IsCollider() -> bool
Position
- auto GetPosition() -> vec3
- Get the current position of the unit for updating.
- auto GetInterpolatedPosition(int32 idt) -> vec3
- Get the current position of the unit for rendering.
- void SetPosition(const vec3& pos, bool smooth = false)
- void SetPosition(float x, float y, float z, bool smooth = false)
- void SetPositionZ(float z, bool smooth = false)
- void SetLayer(int32 layer)
Physics
- auto GetPhysicsBody() -> PhysicsBody*
- auto GetScriptBehavior() -> ref
- auto GetRoughPingDistance() -> uint32
- void SetUpdateDistanceLimit(int32 dist)
Scenes
- void AttachToUnit(const UnitPtr& unit, vec3 offset)
- void DetachFromUnit()
- void SetUnitScene(string name, bool resetTime)
- void SetUnitScene(UnitScene* scene, bool resetTime)
- void SetUnitScene(CustomUnitScene* customScene, bool resetTime)
- auto GetCurrentUnitScene() -> UnitScene*
- auto GetUnitScene(string name) -> UnitScene*
- auto GetUnitSceneTime() -> int32
- void SetUnitSceneTime(int32 time)
- auto GetUnitTimeScale() -> float
- void SetUnitTimeScale(float scale)
- auto FetchLocator(string name) -> vec2
- auto FetchData(string name) -> SValue*
Misc
- auto GetId() -> int32
- auto IsValid() -> bool
- auto GetMoveDir() -> vec2
- auto GetUnitProducer() -> UnitProducer*
- auto GetDebugName() -> string
- auto GetSlot() -> uint32
- void SetHidden(bool hidden)
- auto IsHidden() -> bool
- void Destroy()
- auto IsDestroyed() -> bool
- void Colorize(vec4 darks, vec4 mid, vec4 highlights)
- void SetMultiColor(int32 color, vec4 darks, vec4 mid, vec4 highlights)
- void DisableMultiColor()
- void SetMultiplyColor(vec4 color)
- auto CreateEffectParams(EffectParams* copy = null) -> EffectParams*
- auto GetEffectParams() -> EffectParams*
- auto CountNearbyUnits(UnitProducer* unitType, int32 range) -> int32
Collision
- void SetShouldCollide(bool collides)
- auto ShouldCollide() -> bool
- void SetShouldCollideWithSame(bool collides)
- auto ShouldCollideWithSame() -> bool
- void SetShouldCollideWithTeam(bool collides)
- auto ShouldCollideWithTeam() -> bool
- void SetCollisionTeam(uint16 team)
- auto GetCollisionTeam() -> uint16