ElectroShot class
#include <Jazz2/Actors/Weapons/ElectroShot.h>
Electro (shot).
Projectile of the electro blaster, a high-strength energy ball that passes through solid tiles instead of stopping at walls and trails an expanding swirl of electric particles as it travels. The powered-up variant is slightly faster.
Base classes
- class ShotBase
- Base class of a shot from a player's weapon.
Public static variables
- static AnimState PoweredUpAnimState constexpr
- Animation state of the powered-up variant.
Public static functions
-
static void CreateParticles(ILevelHandler* levelHandler,
Metadata* metadata,
Vector2f pos,
std::
uint16_t layer, float currentStep, bool facingLeft, bool poweredUp) - Spawns one ring of swirl particles, shared with the remote representation of the shot.
-
static void CreateParticles(ILevelHandler* levelHandler,
const GraphicResource* res,
Vector2f pos,
std::
uint16_t layer, float currentStep, bool facingLeft, bool poweredUp) - static void EmitParticleLight(SmallVectorImpl<LightEmitter>& lights, Vector2f pos, float currentStep)
- Emits the light surrounding the swirl, shared with the remote representation of the shot.
Constructors, destructors, conversion operators
- ElectroShot()
- Creates a new instance.
Public functions
-
void OnFire(const std::
shared_ptr<ActorBase>& owner, Vector2f gunspotPos, Vector2f speed, float angle, bool isFacingLeft) - Called when the shot is fired.
- auto GetWeaponType() -> WeaponType override
- Returns weapon type.
- auto OnHandleCollision(ActorBase* other) -> bool override
- Called when the object collides with another object.
Protected functions
- auto OnActivatedAsync(const ActorActivationDetails& details) -> Task<bool> override
- Called when the object is created and activated.
- void OnUpdate(float timeMult) override
- Called every frame to update the object state.
- void OnUpdateHitbox() override
- Called when the hitbox needs to be updated.
- void OnEmitLights(SmallVectorImpl<LightEmitter>& lights) override
- Called when emitting lights.
- void OnEmitRemotedLights(SmallVectorImpl<LightEmitter>& lights) override
- Called when emitting lights that have to be replicated to remote peers.
- auto OnPerish(ActorBase* collider) -> bool override
- Called when the object has no health left and should perish.
- void OnHitWall(float timeMult) override
- Called when the object hits a wall.
- void OnRicochet() override
- Called on shot ricochet.
Function documentation
static void Jazz2:: Actors:: Weapons:: ElectroShot:: CreateParticles(ILevelHandler* levelHandler,
const GraphicResource* res,
Vector2f pos,
std:: uint16_t layer,
float currentStep,
bool facingLeft,
bool poweredUp)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Jazz2:: Actors:: Weapons:: ElectroShot:: OnEmitRemotedLights(SmallVectorImpl<LightEmitter>& lights) override protected
Called when emitting lights that have to be replicated to remote peers.
Defaults to OnEmitLights(). Override it to leave out lights that clients produce on their own.
Variable documentation
static AnimState Jazz2:: Actors:: Weapons:: ElectroShot:: PoweredUpAnimState constexpr
Animation state of the powered-up variant.
The shot is invisible (it renders only through locally-spawned particles), so its animation state is reused to carry the variant to remote clients over the existing animation synchronization.