| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "../SolidObjectBase.h" |
| 4 |
|
| 5 |
namespace Jazz2::Actors::Solid |
| 6 |
{ |
| 7 |
/** @brief Moving platform */ |
| 8 |
class MovingPlatform : public SolidObjectBase |
| 9 |
{ |
| 10 |
DEATH_RUNTIME_OBJECT(SolidObjectBase); |
| 11 |
|
| 12 |
public: |
| 13 |
MovingPlatform(); |
| 14 |
~MovingPlatform(); |
| 15 |
|
| 16 |
bool OnHandleCollision(std::shared_ptr<ActorBase> other) override; |
| 17 |
|
| 18 |
static void Preload(const ActorActivationDetails& details); |
| 19 |
|
| 20 |
protected: |
| 21 |
Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override; |
| 22 |
void OnUpdate(float timeMult) override; |
| 23 |
void OnUpdateHitbox() override; |
| 24 |
bool OnPerish(ActorBase* collider) override; |
| 25 |
bool OnDraw(RenderQueue& renderQueue) override; |
| 26 |
|
| 27 |
private: |
| 28 |
enum class PlatformType { |
| 29 |
CarrotusFruit = 1, |
| 30 |
Ball = 2, |
| 31 |
CarrotusGrass = 3, |
| 32 |
Lab = 4, |
| 33 |
Sonic = 5, |
| 34 |
Spike = 6, |
| 35 |
|
| 36 |
SpikeBall = 7, |
| 37 |
}; |
| 38 |
|
| 39 |
#ifndef DOXYGEN_GENERATING_OUTPUT |
| 40 |
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't |
| 41 |
struct ChainPiece { |
| 42 |
Vector2f Pos; |
| 43 |
std::unique_ptr<RenderCommand> Command; |
| 44 |
}; |
| 45 |
#endif |
| 46 |
|
| 47 |
PlatformType _type; |
| 48 |
float _speed; |
| 49 |
bool _isSwing; |
| 50 |
float _phase; |
| 51 |
Vector2f _originPos, _lastPos; |
| 52 |
|
| 53 |
SmallVector<ChainPiece, 0> _pieces; |
| 54 |
|
| 55 |
Vector2f GetPhasePosition(int distance); |
| 56 |
}; |
| 57 |
} |