ScriptActorWrapper class
Wraps a scripted actor, forwarding engine callbacks to the AngelScript object.
Engine-side Actors::
Base classes
- class Jazz2::Actors::ActorBase
- Base class of an object.
Derived classes
- class ScriptCollectibleWrapper
- Wraps a scripted collectible actor, forwarding engine callbacks to the AngelScript object.
Public static functions
- static void RegisterFactory(asIScriptEngine* engine, asIScriptModule* module)
- Registers the actor factory to the specified AngelScript engine and module.
-
static auto Factory(std::
int32_t actorType) -> ScriptActorWrapper* - Creates a new wrapper instance for the specified actor type.
Constructors, destructors, conversion operators
- ScriptActorWrapper(LevelScriptLoader* levelScripts, asIScriptObject* obj)
- Creates a new instance.
- ~ScriptActorWrapper()
Public functions
- void AddRef()
- Increases the reference count.
- void Release()
- Decreases the reference count, destroying the instance when it reaches zero.
- auto operator=(const ScriptActorWrapper& o) -> ScriptActorWrapper&
- auto OnHandleCollision(ActorBase* other) -> bool override
Protected functions
-
auto OnActivatedAsync(const Actors::
ActorActivationDetails& details) -> Task<bool> override - Called when the object is created and activated.
- auto OnTileDeactivated() -> bool override
- Called when corresponding tile should be deactivated.
- void OnHealthChanged(ActorBase* collider) override
- auto OnPerish(ActorBase* collider) -> bool override
- void OnUpdate(float timeMult) override
- Called every frame to update the object state.
- void OnUpdateHitbox() override
- Called when the hitbox needs to be updated.
- auto OnDraw(RenderQueue& renderQueue) -> bool override
- Called when the object needs to be drawn.
- void OnHitFloor(float timeMult) override
- Called when the object hits a floor.
- void OnHitCeiling(float timeMult) override
- Called when the object hits a ceiling.
- void OnHitWall(float timeMult) override
- Called when the object hits a wall.
- void OnAnimationStarted() override
- Called when an animation started.
- void OnAnimationFinished() override
- Called when an animation finished.
- auto asGetAlpha() const -> float
- Returns the alpha (opacity) of the actor.
- void asSetAlpha(float value)
- Sets the alpha (opacity) of the actor.
- auto asGetLayer() const -> uint16_t
- Returns the rendering layer of the actor.
-
void asSetLayer(std::
uint16_t value) - Sets the rendering layer of the actor.
-
void asDecreaseHealth(std::
int32_t amount) - Decreases the health of the actor by the specified amount.
- auto asMoveTo(float x, float y, bool force) -> bool
- Moves the actor to the specified position, returns
trueon success. - auto asMoveBy(float x, float y, bool force) -> bool
- Moves the actor by the specified offset, returns
trueon success. - void asTryStandardMovement(float timeMult)
- Applies standard movement integration for the current frame.
- void asRequestMetadata(const String& path)
- Requests metadata to be loaded from the specified path.
- void asPlaySfx(const String& identifier, float gain, float pitch)
- Plays a sound effect by its identifier.
-
void asSetAnimationState(std::
int32_t state) - Sets the current animation state.
Function documentation
Jazz2:: Scripting:: ScriptActorWrapper:: ScriptActorWrapper(LevelScriptLoader* levelScripts,
asIScriptObject* obj)
Creates a new instance.
| Parameters | |
|---|---|
| levelScripts | Owning level script loader |
| obj | Backing AngelScript object |