Emergency 20 Dokumentation  4.2.0
ActivityComponent.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 
15 #include <qsf/asset/AssetProxy.h>
18 #include <qsf/job/JobProxy.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26  class Activity;
27  class ActivityPlayer;
28 }
29 
30 
31 //[-------------------------------------------------------]
32 //[ Namespace ]
33 //[-------------------------------------------------------]
34 namespace em5
35 {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Classes ]
40  //[-------------------------------------------------------]
46  {
47 
48 
49  //[-------------------------------------------------------]
50  //[ Public definitions ]
51  //[-------------------------------------------------------]
52  public:
53  static const uint32 COMPONENT_ID;
54  static const uint32 ACTIVITY;
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public methods ]
59  //[-------------------------------------------------------]
60  public:
68  inline explicit ActivityComponent(qsf::Prototype* prototype);
69 
74  inline virtual ~ActivityComponent();
75 
86  inline const qsf::AssetProxy& getActivityAsset() const;
87 
98  void setActivityAsset(const qsf::AssetProxy& asset);
99 
100 
101  //[-------------------------------------------------------]
102  //[ Public virtual qsf::Component methods ]
103  //[-------------------------------------------------------]
104  public:
105  virtual void serialize(qsf::BinarySerializer& serializer) override;
106 
107 
108  //[-------------------------------------------------------]
109  //[ Protected virtual qsf::Component methods ]
110  //[-------------------------------------------------------]
111  protected:
112  virtual bool onStartup() override;
113  virtual void onShutdown() override;
114  virtual void onSetSimulating(bool simulating) override;
115 
116 
117  //[-------------------------------------------------------]
118  //[ Private methods ]
119  //[-------------------------------------------------------]
120  private:
121  void startActivity(Activity& activity);
122  void stopActivity();
123  void updateSimulation(const qsf::JobArguments& jobArgs);
124 
125 
126  //[-------------------------------------------------------]
127  //[ Private data ]
128  //[-------------------------------------------------------]
129  private:
130  // Connected to the CAMP system
131  qsf::AssetProxy mActivityAsset;
132 
133  // Internal
134  ActivityPlayer* mActivityPlayer;
135  qsf::JobProxy mSimulationJobProxy;
136  bool mWasMoveToDespawnActive;
137 
138  // Debug draw
139  qsf::DebugDrawProxy mDebugDrawProxy;
140 
141 
142  //[-------------------------------------------------------]
143  //[ CAMP reflection system ]
144  //[-------------------------------------------------------]
145  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
146 
147 
148  };
149 
150 
151 //[-------------------------------------------------------]
152 //[ Namespace ]
153 //[-------------------------------------------------------]
154 } // em5
155 
156 
157 //[-------------------------------------------------------]
158 //[ Implementation ]
159 //[-------------------------------------------------------]
161 
162 
163 //[-------------------------------------------------------]
164 //[ CAMP reflection system ]
165 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Abstract component class.
Definition: Component.h:105
unsigned int uint32
Definition: PlatformTypes.h:181
Activity component class.
Definition: ActivityComponent.h:45
#define EM5_API_EXPORT
Definition: Export.h:28
Activity player.
Definition: ActivityPlayer.h:43
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
static const uint32 ACTIVITY
"Activity" unique class property ID inside the class
Definition: ActivityComponent.h:54
Debug draw proxy class.
Definition: DebugDrawProxy.h:46
Asset proxy class.
Definition: AssetProxy.h:57
#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
Activity class.
Definition: Activity.h:39
Prototype class.
Definition: Prototype.h:100
Binary serializer class.
Definition: BinarySerializer.h:35
static const uint32 COMPONENT_ID
"em5::ActivityComponent" unique component ID
Definition: ActivityComponent.h:53