| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "../ActorBase.h" |
| 4 |
|
| 5 |
namespace Jazz2::Actors::Environment |
| 6 |
{ |
| 7 |
/** @brief Spring */ |
| 8 |
class Spring : public ActorBase |
| 9 |
{ |
| 10 |
DEATH_RUNTIME_OBJECT(ActorBase); |
| 11 |
|
| 12 |
public: |
| 13 |
Spring(); |
| 14 |
|
| 15 |
/** @brief Whether player horizontal speed should be kept */ |
| 16 |
bool KeepSpeedX; |
| 17 |
/** @brief Whether player vertical speed should be kept */ |
| 18 |
bool KeepSpeedY; |
| 19 |
|
| 20 |
bool OnHandleCollision(std::shared_ptr<ActorBase> other) override; |
| 21 |
|
| 22 |
static void Preload(const ActorActivationDetails& details); |
| 23 |
|
| 24 |
/** @brief Activates the spring */ |
| 25 |
Vector2f Activate(); |
| 26 |
|
| 27 |
protected: |
| 28 |
Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override; |
| 29 |
void OnUpdate(float timeMult) override; |
| 30 |
void OnUpdateHitbox() override; |
| 31 |
|
| 32 |
private: |
| 33 |
enum class State { |
| 34 |
Default, |
| 35 |
Frozen, |
| 36 |
Heated |
| 37 |
}; |
| 38 |
|
| 39 |
enum class Orientation : uint8_t { |
| 40 |
Bottom, |
| 41 |
Right, |
| 42 |
Top, |
| 43 |
Left |
| 44 |
}; |
| 45 |
|
| 46 |
uint8_t _type; |
| 47 |
Orientation _orientation; |
| 48 |
float _strength; |
| 49 |
uint8_t _delay; |
| 50 |
State _state; |
| 51 |
float _cooldown; |
| 52 |
}; |
| 53 |
} |