ScriptPlayerWrapper class
Wraps a player actor for access from AngelScript.
Reference-counted bridge object that exposes a live Actors::
Public static functions
- static void RegisterFactory(asIScriptEngine* engine)
- Registers the player factory to the specified AngelScript engine.
-
static auto Factory(std::
int32_t playerIndex) -> ScriptPlayerWrapper* - Creates a new wrapper instance for the player with the specified index.
Constructors, destructors, conversion operators
-
ScriptPlayerWrapper(LevelScriptLoader* levelScripts,
std::
int32_t playerIndex) - Creates a new instance from the specified player index.
-
ScriptPlayerWrapper(LevelScriptLoader* levelScripts,
Actors::
Player* player) - Creates a new instance from the specified player.
- ~ScriptPlayerWrapper()
Public functions
- void AddRef()
- Increases the reference count.
- void Release()
- Decreases the reference count, destroying the instance when it reaches zero.
- auto operator=(const ScriptPlayerWrapper& o) -> ScriptPlayerWrapper&
Protected functions
- auto asIsInGame() const -> bool
- Returns
trueif the player is currently in game. -
auto asGetIndex() const -> std::
int32_t - Returns the index of the player.
-
auto asGetPlayerType() const -> std::
int32_t - Returns the type of the player.
- auto asGetX() const -> float
- Returns the horizontal position of the player.
- auto asGetY() const -> float
- Returns the vertical position of the player.
- auto asGetSpeedX() const -> float
- Returns the horizontal speed of the player.
- auto asGetSpeedY() const -> float
- Returns the vertical speed of the player.
-
auto asGetHealth() const -> std::
int32_t - Returns the current health of the player.
-
auto asGetLives() const -> std::
int32_t - Returns the number of remaining lives of the player.
-
auto asGetFoodEaten() const -> std::
int32_t - Returns the amount of food eaten by the player.
-
auto asGetScore() const -> std::
int32_t - Returns the current score of the player.
-
void asSetScore(std::
int32_t value) - Sets the current score of the player.
-
auto asGetLayer() const -> std::
uint16_t - Returns the rendering layer of the player.
- void asSetLayer(uint16_t value)
- Sets the rendering layer of the player.
- auto asGetWeaponAllowed() const -> bool
- Returns
trueif weapons are currently allowed for the player. - void asSetWeaponAllowed(bool value)
- Sets whether weapons are allowed for the player.
-
auto asGetWeaponAmmo(std::
int32_t weaponType) const -> std:: int32_t - Returns the ammo count for the specified weapon type.
-
void asSetWeaponAmmo(std::
int32_t weaponType, std:: int32_t value) - Sets the ammo count for the specified weapon type.
-
void asDecreaseHealth(std::
int32_t amount) - Decreases the health of the player by the specified amount.
- void asMoveTo(float x, float y)
- Moves the player to the specified position.
- void asWarpTo(float x, float y)
- Warps the player to the specified position.
- void asMoveBy(float x, float y)
- Moves the player by the specified offset.
- 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.
-
void asMorphTo(std::
int32_t playerType) - Morphs the player into the specified player type.
- void asMorphRevert()
- Reverts a previous morph back to the original player type.
Function documentation
Jazz2:: Scripting:: ScriptPlayerWrapper:: ScriptPlayerWrapper(LevelScriptLoader* levelScripts,
std:: int32_t playerIndex)
Creates a new instance from the specified player index.
| Parameters | |
|---|---|
| levelScripts | Owning level script loader |
| playerIndex | Index of the wrapped player |
Jazz2:: Scripting:: ScriptPlayerWrapper:: ScriptPlayerWrapper(LevelScriptLoader* levelScripts,
Actors:: Player* player)
Creates a new instance from the specified player.
| Parameters | |
|---|---|
| levelScripts | Owning level script loader |
| player | Wrapped player actor |