Emergency 20 Dokumentation  4.2.0
FreeplaySystem.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 //[-------------------------------------------------------]
15 
16 #include <qsf/base/System.h>
17 #include <qsf/time/Time.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class BinarySerializer;
26 }
27 namespace em5
28 {
29  class FreeplayEventManager;
30  class FreeplayEventFactoryManager;
31  class FreeplayEventGenerator;
32  class FreeplayEventPoolManager;
33  class FreeplayEventTriggerInfo;
34  class CleanupManager;
35  class ObjectiveManager;
36  class DensityCalculator;
37  class GameMode;
38 }
39 
40 
41 //[-------------------------------------------------------]
42 //[ Namespace ]
43 //[-------------------------------------------------------]
44 namespace em5
45 {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Classes ]
50  //[-------------------------------------------------------]
56  {
57 
58 
59  //[-------------------------------------------------------]
60  //[ Public definitions ]
61  //[-------------------------------------------------------]
62  public:
63  typedef std::vector<std::string> EventPoolArray;
64  typedef std::unordered_map<std::string, std::string> GameModeClassNameMapping;
65 
66 
67  //[-------------------------------------------------------]
68  //[ Public methods ]
69  //[-------------------------------------------------------]
70  public:
76 
81  virtual ~FreeplaySystem();
82 
83  //[-------------------------------------------------------]
84  //[ Lifecycle ]
85  //[-------------------------------------------------------]
90  void loadEventPoolAssets();
91 
96  void startupFreeplay();
97 
102  void shutdownFreeplay();
103 
108  void updateFreeplay(const qsf::Time& timePassed);
109 
117  GameModeClassNameMapping& getGameModeClassNameMapping();
118 
123  GameMode* getGameMode() const;
124 
129  void sendGameModeSignal(const std::string& gameModeSignal);
130 
131  //[-------------------------------------------------------]
132  //[ Manager getters ]
133  //[-------------------------------------------------------]
138  inline FreeplayEventManager& getEventManager() const;
139 
144  inline FreeplayEventFactoryManager& getFactoryManager() const;
145 
150  inline FreeplayEventGenerator& getEventGenerator() const;
151 
156  inline FreeplayEventPoolManager& getEventPoolManager() const;
157 
162  inline ObjectiveManager& getObjectiveManager() const;
163 
168  inline CleanupManager& getCleanupManager() const;
169 
174  inline DensityCalculator& getDensityCalculator() const;
175 
176  //[-------------------------------------------------------]
177  //[ Event management ]
178  //[-------------------------------------------------------]
183  void insertFreeplayEvent(FreeplayEvent& freeplayEvent);
184 
195  FreeplayEvent* triggerEventByPath(const std::string& eventPath, const FreeplayEventTriggerInfo& triggerInfo);
196 
201  void triggerLastEvent();
202 
213  bool setEventPoolsByName(const std::string& poolsName);
214 
225  bool addEventPoolsByName(const std::string& poolsName);
226 
237  bool removeEventPoolsByName(const std::string& poolsName);
238 
243  void onEventFinished(FreeplayEvent& freeplayEvent, FreeplayEvent::EventResult& eventResult);
244 
245  void onObjectiveGetsPoints(FreeplayEvent& freeplayEvent, FreeplayEvent::ObjectiveResult& objectiveResult);
246 
251  void onAbortEvent(FreeplayEvent& freeplayEvent);
252 
253  //[-------------------------------------------------------]
254  //[ Serialization ]
255  //[-------------------------------------------------------]
256  void serialize(qsf::BinarySerializer& serializer);
257 
258 
259  //[-------------------------------------------------------]
260  //[ Public virtual qsf::System methods ]
261  //[-------------------------------------------------------]
262  public:
263  virtual const char* getName() const override;
264 
265  //[-------------------------------------------------------]
266  //[ Lifecycle ]
267  //[-------------------------------------------------------]
268  virtual bool onStartup(bool serverMode) override;
269  virtual void onShutdown() override;
270 
271 
272  //[-------------------------------------------------------]
273  //[ Private data ]
274  //[-------------------------------------------------------]
275  private:
276  EventPoolArray mCurrentEventPool;
277  FreeplayEventManager& mEventManager;
278  FreeplayEventFactoryManager& mFactoryManager;
279  FreeplayEventGenerator& mEventGenerator;
280  FreeplayEventPoolManager& mEventPoolManager;
281  CleanupManager& mCleanupManager;
282  ObjectiveManager& mObjectiveManager;
283  DensityCalculator& mDensityCalculator;
284 
285  // Game mode
286  GameModeClassNameMapping mGameModeClassNameMapping;
287  GameMode* mGameMode;
288 
289 
290  };
291 
292 
293 //[-------------------------------------------------------]
294 //[ Namespace ]
295 //[-------------------------------------------------------]
296 } // em5
297 
298 
299 //[-------------------------------------------------------]
300 //[ Implementation ]
301 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: FreeplayEvent.h:110
Definition: FreeplayEventTriggerInfo.h:28
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: FreeplayEvent.h:131
EMERGENCY 5 freeplay event factory manager.
Definition: FreeplayEventFactoryManager.h:52
Manager for cleanups.
Definition: CleanupManager.h:52
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
GameMode
< Connected to CAMP
Definition: MatchmakingTypes.h:41
Definition: PickupPersonByParamedicAction.h:21
EMERGENCY 5 freeplay event pool manager.
Definition: FreeplayEventPoolManager.h:44
Abstract system class.
Definition: System.h:48
EMERGENCY 5 freeplay event generation class.
Definition: FreeplayEventGenerator.h:46
std::unordered_map< std::string, std::string > GameModeClassNameMapping
Definition: FreeplaySystem.h:64
std::vector< std::string > EventPoolArray
Definition: FreeplaySystem.h:63
EMERGENCY 5 freeplay density falculator.
Definition: DensityCalculator.h:52
EMERGENCY 5 objective manager.
Definition: ObjectiveManager.h:45
EMERGENCY 5 freeplay event factory manager.
Definition: FreeplayEventManager.h:34
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 game mode base class.
Definition: GameMode.h:31
EMERGENCY 5 freeplay system.
Definition: FreeplaySystem.h:55
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32