Emergency 20 Dokumentation  4.2.0
RescueBusComponent.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 
16 #include <qsf/job/JobProxy.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  namespace multiplayer
26  {
27  class RescueBusData;
28  }
29 }
30 
31 
32 //[-------------------------------------------------------]
33 //[ Namespace ]
34 //[-------------------------------------------------------]
35 namespace em5
36 {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Classes ]
41  //[-------------------------------------------------------]
47  {
48 
49 
50  //[-------------------------------------------------------]
51  //[ Friends ]
52  //[-------------------------------------------------------]
53  friend class multiplayer::RescueBusData; // Needed for multiplay
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public definitions ]
58  //[-------------------------------------------------------]
59  public:
60  static const uint32 COMPONENT_ID;
61 
62 
63  //[-------------------------------------------------------]
64  //[ Public methods ]
65  //[-------------------------------------------------------]
66  public:
74  explicit RescueBusComponent(qsf::Prototype* prototype);
75 
80  virtual ~RescueBusComponent();
81 
82  bool isHidden() const;
83  bool isAnimationPlaying() const;
84  bool isExtended() const;
85 
86  void startExtending();
87  void hideExtending();
88 
89  const glm::vec3& getCollisionExtended() const;
90  void setCollisionExtended(const glm::vec3& collisionExtentExtended);
91 
92  bool checkCollisionForExtending();
93 
94 
95  //[-------------------------------------------------------]
96  //[ Private methods ]
97  //[-------------------------------------------------------]
98  private:
99  void activateJob();
100  void deactivateJob();
101  void updateJob(const qsf::JobArguments& jobArguments);
102  void registerRescueBusParts();
103 
104 
105  //[-------------------------------------------------------]
106  //[ Protected virtual qsf::Component methods ]
107  //[-------------------------------------------------------]
108  protected:
109  virtual void onShutdown() override;
110 
111 
112  //[-------------------------------------------------------]
113  //[ Private definitions ]
114  //[-------------------------------------------------------]
115  private:
116  enum RescueBusState
117  {
118  RESCUEBUSSTATE_HIDDEN,
119  RESCUEBUSSTATE_EXTENDING_ANIMATION,
120  RESCUEBUSSTATE_EXTENDED,
121  RESCUEBUSSTATE_HIDDING_ANIMATION
122  };
123 
124 
125  //[-------------------------------------------------------]
126  //[ Private methods ]
127  //[-------------------------------------------------------]
128  private:
129  void enableCollisionShapeExtended();
130  void disableCollisionShapeExtended();
131  void enableNavigationComponent(bool enable);
132 
133 
134  //[-------------------------------------------------------]
135  //[ Private data ]
136  //[-------------------------------------------------------]
137  private:
138  RescueBusState mRescueBusState;
139  qsf::WeakPtr<qsf::Entity> mRescueBusSide;
140  glm::vec3 mDeployedCollisionExtend;
141 
142  // Internal
143  qsf::JobProxy mUpdateJobProxy;
144  AudioProxy mAudioProxy;
145  qsf::DebugDrawProxy mDebugDrawProxy;
146 
147 
148  //[-------------------------------------------------------]
149  //[ CAMP reflection system ]
150  //[-------------------------------------------------------]
151  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
152 
153 
154  };
155 
156 
157 //[-------------------------------------------------------]
158 //[ Namespace ]
159 //[-------------------------------------------------------]
160 } // em5
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
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 entity with a rescue bus component data cache for a single entity for multiplayer...
Definition: RescueBusData.h:55
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Debug draw proxy class.
Definition: DebugDrawProxy.h:46
#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
static const uint32 COMPONENT_ID
"qsf::RescueBusComponent" unique component ID
Definition: RescueBusComponent.h:60
Rescue bus component is for the expandable part of the IMT rescue bus.
Definition: RescueBusComponent.h:46
Prototype class.
Definition: Prototype.h:100