Emergency 20 Dokumentation  4.2.0
AreaExtinguishAction.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 //[-------------------------------------------------------]
13 #include "em5/audio/AudioProxy.h"
14 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24  class FireComponent;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
51 
52  enum State
53  {
58  STATE_FLY_AWAY
59  };
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public methods ]
64  //[-------------------------------------------------------]
65  public:
71 
76  virtual ~AreaExtinguishAction();
77 
78  void init(glm::vec3 targetPosition, qsf::Time durration, float radius, float extinguishPower, float coolingPowerPerSecond);
79 
80 
81  //[-------------------------------------------------------]
82  //[ Public virtual qsf::Actions methods ]
83  //[-------------------------------------------------------]
84  public:
85  virtual void serialize(qsf::BinarySerializer& serializer) override;
86 
87 
88  //[-------------------------------------------------------]
89  //[ Protected virtual qsf::Action methods ]
90  //[-------------------------------------------------------]
91  protected:
92  virtual bool onStartup() override;
93  virtual void onShutdown() override;
94  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
95 
96 
97  //[-------------------------------------------------------]
98  //[ Private methods ]
99  //[-------------------------------------------------------]
100  private:
101  void createAirPlaneEntity();
102  void createGroundEffectMarker();
103  void createAirParticleEffect();
104  void createGroundParticleEffect();
105 
106  void updateAirplanePosition(qsf::Time elapsedTime);
107  void updateGroundParticle(qsf::Time elapsedTime);
108 
109  void deactivateEffectParticle();
110  void deactivateEffectParticleAir();
111  void deleteParticleEffects();
112  void closeHatch();
113  void damagePersonsInArea(float timePassedInSeconds);
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private data ]
118  //[-------------------------------------------------------]
119  private:
120  std::vector<FireComponent*> mExtinguishFireComponents;
121  State mState;
122  glm::vec3 mTargetPosition;
123  qsf::WeakPtr<qsf::Entity> mAirplaneEntity;
124  qsf::WeakPtr<qsf::Entity> mGroundMarkerEntity;
125  qsf::WeakPtr<qsf::Entity> mRadarEntity;
126  qsf::WeakPtr<qsf::Entity> mEffectParticleAir;
127  std::vector<qsf::WeakPtr<qsf::Entity>> mEffectParticlesGround;
128  bool mCanPlayPersonDamageHint;
129  glm::quat mInitialRadarRotation;
130 
131  // Configuration
132  qsf::Time mDurration;
133  qsf::Time mDurrationAirEffect;
134  qsf::Time mTotalDuration;
135  float mExtinguishPowerPerSecond;
136  float mCoolingPowerPerSecond;
137  float mRadius;
138 
139  // Particle handling
140  glm::vec3 mEffectStartPosition;
141  qsf::Time mTimeLastGroundEffect;
142 
143  // Audio
144  AudioProxy mAudioProxyAirplane;
145  AudioProxy mAudioProxyEffectStart;
146  AudioProxy mAudioProxyEffectImpact;
147 
148  AudioProxy mAudioProxyRadarNoise;
149  AudioProxy mAudioProxyUseAirplaneFeedback;
150 
151 
152  //[-------------------------------------------------------]
153  //[ CAMP reflection system ]
154  //[-------------------------------------------------------]
155  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
156 
157 
158  };
159 
160 
161 //[-------------------------------------------------------]
162 //[ Namespace ]
163 //[-------------------------------------------------------]
164 } // em5
165 
166 
167 //[-------------------------------------------------------]
168 //[ CAMP reflection system ]
169 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: AreaExtinguishAction.h:57
State
Definition: AreaExtinguishAction.h:52
EMERGENCY 5 area extinguish action.
Definition: AreaExtinguishAction.h:42
Definition: AreaExtinguishAction.h:55
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
static const qsf::NamedIdentifier ACTION_ID
"em5::AreaExtinguishAction" unique action identifier
Definition: AreaExtinguishAction.h:50
Definition: AreaExtinguishAction.h:56
Definition: AreaExtinguishAction.h:54
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
State
Definition: ProcessState.h:20
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32