Pole class
#include <Jazz2/Actors/Solid/Pole.h>
Pole.
An upright tree trunk or vine (Diamondus, Carrotus, Jungle, etc.) that the player can shoot or blow up with TNT to make it topple over, where it falls in the hit direction and bounces a few times before coming to rest, often forming a bridge or clearing a path.
Base classes
- class Jazz2::Actors::ActorBase
- Base class of an object.
Public types
- enum class FallDirection { None, Right, Left, Fallen }
- Direction the pole is falling in.
Public static functions
- static void Preload(const ActorActivationDetails& details)
- Preloads all assets required by this actor.
Constructors, destructors, conversion operators
- Pole()
- Creates a new instance.
Public functions
- auto OnHandleCollision(ActorBase* other) -> bool override
- Called when the object collides with another object.
- auto CanCauseDamage(ActorBase* collider) -> bool override
- Called to check whether
collidercan cause damage to the object. - auto GetFallDirection() const -> FallDirection
- Returns the direction the pole is falling in.
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 OnSerializeState(Stream& dest) override
- Serializes the live state of the object to a level state snapshot.
- void OnDeserializeState(Stream& src) override
- Restores the live state of the object from a level state snapshot.
- void OnPacketReceived(MemoryStream& packet) override
- Called when the object receives a network packet.
Enum documentation
enum class Jazz2:: Actors:: Solid:: Pole:: FallDirection
Direction the pole is falling in.
| Enumerators | |
|---|---|
| None |
Standing upright |
| Right |
Falling to the right |
| Left |
Falling to the left |
| Fallen |
Finished falling |
Function documentation
void Jazz2:: Actors:: Solid:: Pole:: OnSerializeState(Stream& dest) override protected
Serializes the live state of the object to a level state snapshot.
Called only if IsSerializable() returns true. Anything that is initialized from the event parameters in OnActivatedAsync() doesn't need to be stored, because the object is spawned again with the same parameters before OnDeserializeState() is called. Derived classes must call the base implementation first and read the data back in the same order.
void Jazz2:: Actors:: Solid:: Pole:: OnDeserializeState(Stream& src) override protected
Restores the live state of the object from a level state snapshot.
Called right after the object was spawned again (i.e., after OnActivatedAsync()) and before it's added to the level. Running transitions are not restored, because their callbacks cannot be serialized, so derived classes have to put the object into a state that doesn't wait for such a callback.