1#pragma once
2
3#include "Library/Nerve/NerveExecutor.h"
4
5namespace al {
6class NerveStateBase : public NerveExecutor {
7public:
8 NerveStateBase(const char* stateName);
9
10 virtual void init() {}
11
12 virtual void appear() { mIsDead = false; }
13
14 virtual void kill() { mIsDead = true; }
15
16 virtual bool update();
17
18 virtual void control() {}
19
20 bool isDead() const { return mIsDead; }
21
22private:
23 bool mIsDead = true;
24};
25
26class LiveActor;
27
28class ActorStateBase : public NerveStateBase {
29public:
30 ActorStateBase(const char* stateName, LiveActor* actor);
31
32protected:
33 LiveActor* mActor;
34};
35
36template <class T>
37class HostStateBase : public NerveStateBase {
38public:
39 HostStateBase(const char* name, T* host) : NerveStateBase(name), mHost(host) {}
40
41 T* getHost() const { return mHost; }
42
43private:
44 T* mHost;
45};
46
47} // namespace al
48