Debian Codegraph @

Sources/Jazz2/Actors/Enemies/Bosses/TurtleBoss.h

raw
1 #pragma once
2
3 #include "BossBase.h"
4
5 namespace Jazz2::Actors::Bosses
6 {
7 /** @brief Turtle (boss) */
8 class TurtleBoss : public BossBase
9 {
10 DEATH_RUNTIME_OBJECT(BossBase);
11
12 public:
13 TurtleBoss();
14 ~TurtleBoss();
15
16 static void Preload(const ActorActivationDetails& details);
17
18 bool OnHandleCollision(std::shared_ptr<ActorBase> other) override;
19
20 protected:
21 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
22 bool OnActivatedBoss() override;
23 void OnUpdate(float timeMult) override;
24 bool OnPerish(ActorBase* collider) override;
25
26 private:
27 static constexpr std::int32_t StateTransition = -1;
28 static constexpr std::int32_t StateWaiting = 0;
29 static constexpr std::int32_t StateWalking1 = 1;
30 static constexpr std::int32_t StateWalking2 = 2;
31 static constexpr std::int32_t StateAttacking = 3;
32
33 #ifndef DOXYGEN_GENERATING_OUTPUT
34 // Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
35 class Mace : public EnemyBase
36 {
37 DEATH_RUNTIME_OBJECT(EnemyBase);
38
39 public:
40 ~Mace();
41
42 protected:
43 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
44 void OnUpdate(float timeMult) override;
45 void OnUpdateHitbox() override;
46
47 private:
48 static constexpr float TotalTime = 60.0f;
49
50 Vector2f _originPos;
51 Vector2f _targetPos;
52 bool _returning;
53 float _returnTime;
54 Vector2f _targetSpeed;
55 #if defined(WITH_AUDIO)
56 std::shared_ptr<AudioBufferPlayer> _sound;
57 #endif
58
59 void FollowNearestPlayer();
60 };
61 #endif
62
63 std::int32_t _state;
64 float _stateTime;
65 std::uint8_t _endText;
66 Vector2f _originPos;
67 std::shared_ptr<Mace> _mace;
68 float _maceTime;
69
70 void FollowNearestPlayer(std::int32_t newState, float time);
71 };
72 }