Emergency 20 Dokumentation  4.2.0
ChangeMaskAction.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/Export.h"
14 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public definitions ]
38  //[-------------------------------------------------------]
39  public:
41 
43  {
45  REMOVE_MASK
46  };
47 
48 
49  //[-------------------------------------------------------]
50  //[ Public methods ]
51  //[-------------------------------------------------------]
52  public:
58 
63  virtual ~ChangeMaskAction();
64 
69  void init(ActionType actionType);
70 
71 
72  //[-------------------------------------------------------]
73  //[ Public virtual qsf::Actions methods ]
74  //[-------------------------------------------------------]
75  public:
76  virtual void serialize(qsf::BinarySerializer& serializer) override;
77 
78 
79  //[-------------------------------------------------------]
80  //[ Protected virtual qsf::Action methods ]
81  //[-------------------------------------------------------]
82  protected:
83  virtual bool onStartup() override;
84  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
85 
86 
87  //[-------------------------------------------------------]
88  //[ Private methods ]
89  //[-------------------------------------------------------]
90  private:
91  void createMask();
92  void destroyMask();
93  void fadeEquipment(bool fadeIn);
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private definitions ]
98  //[-------------------------------------------------------]
99  private:
100  enum State
101  {
102  STATE_INIT,
103  STATE_FADE_OUT_EQUIPMENT,
104  STATE_SWITCH_MESH,
105  STATE_REMOVE_MASK,
106  STATE_START_FADE_IN,
107  STATE_FADE_IN
108  };
109 
110 
111  //[-------------------------------------------------------]
112  //[ Private data ]
113  //[-------------------------------------------------------]
114  private:
115  ActionType mActionType;
116  State mState;
117  qsf::Time mFadeEquipmentTime;
118  qsf::Time mTimeUntilStateSwitch;
119  qsf::WeakPtr<qsf::Entity> mMaskEntity;
120 
121 
122  //[-------------------------------------------------------]
123  //[ CAMP reflection system ]
124  //[-------------------------------------------------------]
125  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
126 
127 
128  };
129 
130 
131 //[-------------------------------------------------------]
132 //[ Namespace ]
133 //[-------------------------------------------------------]
134 } // em5
135 
136 
137 //[-------------------------------------------------------]
138 //[ CAMP reflection system ]
139 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
static const qsf::NamedIdentifier ACTION_ID
"em5::ChangeMaskAction" unique action identifier
Definition: ChangeMaskAction.h:40
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: ChangeMaskAction.h:44
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
EMERGENCY 5 change mask action. Used for fireman switching to/from dust mask.
Definition: ChangeMaskAction.h:32
State
Definition: ProcessState.h:20
ActionType
Definition: ChangeMaskAction.h:42
#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
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