Emergency 20 Dokumentation  4.2.0
RescueDogLeaderLogic.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"
15 
16 #include <qsf/map/Entity.h>
17 #include <qsf/job/JobProxy.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class ActionComponent;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Static public methods ]
49  //[-------------------------------------------------------]
50  public:
51  static qsf::Entity* createRescueDogEntity(qsf::Entity& rescueDogLeaderEntity);
52  static qsf::Entity* getRescueDogEntityFromLeader(qsf::Entity& rescueDogLeaderEntity);
53  static void delinkDogFromLeader(qsf::Entity& rescueDogLeaderEntity);
54  static void linkDogWithLeader(qsf::Entity& rescueDogLeaderEntity, bool leavingVehicle = false);
55  static void callRescueDogBack(qsf::Entity& rescueDogLeaderEntity);
56  static void playDogPantAudio(qsf::Entity& rescueDogLeaderEntity, bool pant);
57  // An alternate RescueDogLeaderLogic::getIsDogUnitedWithLeader() implementation that works on multiplayer clients but is more complex
58  static bool checkIsRescueDogUnitedWithLeader(qsf::Entity& rescueDogLeaderEntity);
59 
60 
61  //[-------------------------------------------------------]
62  //[ Public definitions ]
63  //[-------------------------------------------------------]
64  public:
65  static const uint32 GAMELOGIC_TYPE_ID; // "em5::RescueDogLeaderLogic" game logic type ID
66 
67 
68  //[-------------------------------------------------------]
69  //[ Public methods ]
70  //[-------------------------------------------------------]
71  public:
73 
74  void setIsDogUnitedWithLeader(bool value);
75  bool getIsDogUnitedWithLeader();
76 
77  void setRescueDog(qsf::Entity* dogEntity);
78  qsf::Entity* getRescueDog();
79 
80 
81  //[-------------------------------------------------------]
82  //[ Public virtual qsf::GameLogic methods ]
83  //[-------------------------------------------------------]
84  public:
85  virtual bool onStartup() override;
86  virtual void onShutdown() override;
87 
88 
89  //[-------------------------------------------------------]
90  //[ Private definitions ]
91  //[-------------------------------------------------------]
92  private:
93  static const uint32 ACTION_PRIORITY;
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private methods ]
98  //[-------------------------------------------------------]
99  private:
104  void takeDogFromVehicle(const qsf::MessageParameters& parameters);
105 
110  void putDogInVehicle(const qsf::MessageParameters& parameters);
111 
116  void dieRescueDog(const qsf::MessageParameters& parameters);
117 
122  void onContaminated(const qsf::MessageParameters& parameters);
123 
124  void updateStuckResolving(const qsf::JobArguments& jobArguments);
125 
126  void startWaitForEnterVehicle(const qsf::MessageParameters& parameters);
127  void abortWaitForEnterVehicle(const qsf::MessageParameters& parameters);
128 
129  void pushSignalActionAndSetupMessageHandler(uint64 vehicleEntityId, qsf::ActionComponent& actionComponent);
130 
131 
132  //[-------------------------------------------------------]
133  //[ Private data ]
134  //[-------------------------------------------------------]
135  private:
136  qsf::Time mTimeWaiting;
137  qsf::WeakPtr<qsf::Entity> mRescueDogEntity;
138  bool mIsDogUnitedWithLeader;
139  AudioProxy mAudioProxy;
140  qsf::Time mSafetyStuckResolvingTime;
141 
142  // We need this message proxy to get or put away the Dog and have a safe serialization
143  qsf::MessageProxy mExitVehicleProxy;
144  qsf::MessageProxy mEnterVehicleProxy;
145  qsf::MessageProxy mLeaderInjured;
146  qsf::MessageProxy mLeaderContaminated;
147  qsf::JobProxy mSafetyStuckResolvingJob;
148  qsf::MessageProxy mEnterVehicleWithoutEquipmentProxy;
149  qsf::MessageProxy mEnterVehicleWithoutEquipmentAbortProxy;
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
Job proxy class.
Definition: JobProxy.h:51
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
Carry person logic.
Definition: CarryPersonLogic.h:33
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
uint64_t uint64
Definition: PlatformTypes.h:184
Rescue dog leader logic.
Definition: RescueDogLeaderLogic.h:43
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Definition: PickupPersonByParamedicAction.h:21
#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
Action component.
Definition: ActionComponent.h:47
static const uint32 GAMELOGIC_TYPE_ID
Definition: RescueDogLeaderLogic.h:65
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32