Debian Codegraph @

Sources/Jazz2/Actors/Solid/Pole.h

raw
1 #pragma once
2
3 #include "../ActorBase.h"
4
5 namespace Jazz2::Actors::Solid
6 {
7 /** @brief Pole */
8 class Pole : public ActorBase
9 {
10 DEATH_RUNTIME_OBJECT(ActorBase);
11
12 public:
13 enum class FallDirection {
14 None,
15 Right,
16 Left,
17 Fallen
18 };
19
20 Pole();
21
22 bool OnHandleCollision(std::shared_ptr<ActorBase> other) override;
23 bool CanCauseDamage(ActorBase* collider) override;
24
25 FallDirection GetFallDirection() const {
26 return _fall;
27 }
28
29 static void Preload(const ActorActivationDetails& details);
30
31 protected:
32 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
33 void OnUpdate(float timeMult) override;
34 void OnPacketReceived(MemoryStream& packet) override;
35
36 private:
37 static constexpr std::int32_t BouncesMax = 3;
38
39 FallDirection _fall;
40 float _angleVel;
41 float _angleVelLast;
42 float _fallTime;
43 std::int32_t _bouncesLeft = BouncesMax;
44
45 void Fall(FallDirection dir);
46 bool IsPositionBlocked();
47 };
48 }