Emergency 20 Dokumentation  4.2.0
HintLowEnergyObserver.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
15 #include <qsf/job/JobProxy.h>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
38  {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public definitions ]
43  //[-------------------------------------------------------]
44  public:
45  static const uint32 GAMELOGIC_TYPE_ID; // "em5::HintLowEnergyObserver" game logic type ID
46 
48  {
51  HINTENERGYTYPE_DAMAGE
52  };
53 
54 
55  //[-------------------------------------------------------]
56  //[ Public methods ]
57  //[-------------------------------------------------------]
58  public:
64 
69  void initialize(float energyThreshold, HintEnergyType energyType);
70 
71 
72  //[-------------------------------------------------------]
73  //[ Public virtual qsf::GameLogic methods ]
74  //[-------------------------------------------------------]
75  public:
76  virtual bool onStartup() override;
77  virtual void onShutdown() override;
78  virtual void serialize(qsf::BinarySerializer& serializer) override;
79 
80 
81  //[-------------------------------------------------------]
82  //[ Private methods ]
83  //[-------------------------------------------------------]
84  private:
85  void updateObserver(const qsf::JobArguments& jobArguments);
86  bool checkEnergy();
87 
88 
89  //[-------------------------------------------------------]
90  //[ Private data ]
91  //[-------------------------------------------------------]
92  private:
93  float mThresholdEnergy;
94  HintEnergyType mEnergyType;
95  qsf::JobProxy mUpdateJobProxy;
96 
97 
98  //[-------------------------------------------------------]
99  //[ CAMP reflection system ]
100  //[-------------------------------------------------------]
101  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
102 
103 
104  };
105 
106 
107 //[-------------------------------------------------------]
108 //[ Namespace ]
109 //[-------------------------------------------------------]
110 } // em5
111 
112 
113 //[-------------------------------------------------------]
114 //[ CAMP reflection system ]
115 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Job proxy class.
Definition: JobProxy.h:51
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: HintLowEnergyObserver.h:50
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
EMERGENCY 5 logic hint observer person has low energy.
Definition: HintLowEnergyObserver.h:37
HintEnergyType
Definition: HintLowEnergyObserver.h:47
Definition: HintLowEnergyObserver.h:49
Binary serializer class.
Definition: BinarySerializer.h:35
static const uint32 GAMELOGIC_TYPE_ID
Definition: HintLowEnergyObserver.h:45