Emergency 20 Dokumentation  4.2.0
SpawnPointComponent.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 #include <qsf/time/Time.h>
17 
18 #include <vector>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class Map;
27  class Entity;
28  class Transform;
29 }
30 
31 
32 //[-------------------------------------------------------]
33 //[ Namespace ]
34 //[-------------------------------------------------------]
35 namespace em5
36 {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Classes ]
41  //[-------------------------------------------------------]
50  {
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public definitions ]
55  //[-------------------------------------------------------]
56  public:
57  static const uint32 COMPONENT_ID;
58 
59 
60  //[-------------------------------------------------------]
61  //[ Public static methods ]
62  //[-------------------------------------------------------]
63  public:
68  static qsf::Entity* spawnRandomAt(const qsf::Transform& transform, qsf::Map& map, const std::string& spawnPoolName, bool checkCollisions = true);
69 
70 
71  //[-------------------------------------------------------]
72  //[ Public methods ]
73  //[-------------------------------------------------------]
74  public:
82  inline explicit SpawnPointComponent(qsf::Prototype* prototype);
83 
88  inline virtual ~SpawnPointComponent();
89 
90  inline const std::vector<std::string>& getList() const;
91  inline void setList(const std::vector<std::string>& list);
92 
97  qsf::Entity* spawnRandom(bool checkCollisions = true, const qsf::Time& fadeTime = qsf::Time::fromSeconds(1.0f)) const;
98 
109  bool canSpawnWithoutCollision(qsf::Map& foreignMap);
110 
111 
112  //[-------------------------------------------------------]
113  //[ Public virtual em5::SpawnPointComponent methods ]
114  //[-------------------------------------------------------]
115  public:
116  inline virtual bool isEntry() const { return false; }
117  inline virtual bool isExit() const { return false; }
118  inline virtual bool isTransit() const { return false; }
119 
120 
121  //[-------------------------------------------------------]
122  //[ Public virtual qsf::Component methods ]
123  //[-------------------------------------------------------]
124  public:
125  virtual void serialize(qsf::BinarySerializer& serializer) override;
126 
127 
128  //[-------------------------------------------------------]
129  //[ Protected data ]
130  //[-------------------------------------------------------]
131  protected:
132  std::vector<std::string> mList;
133 
134 
135  //[-------------------------------------------------------]
136  //[ CAMP reflection system ]
137  //[-------------------------------------------------------]
138  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
139 
140 
141  };
142 
143 
144 //[-------------------------------------------------------]
145 //[ Namespace ]
146 //[-------------------------------------------------------]
147 } // em5
148 
149 
150 //[-------------------------------------------------------]
151 //[ Implementation ]
152 //[-------------------------------------------------------]
154 
155 
156 //[-------------------------------------------------------]
157 //[ CAMP reflection system ]
158 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
Map class.
Definition: Map.h:93
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
virtual bool isEntry() const
Definition: SpawnPointComponent.h:116
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
3D transform class
Definition: Transform.h:45
Definition: PickupPersonByParamedicAction.h:21
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
virtual bool isExit() const
Definition: SpawnPointComponent.h:117
std::vector< std::string > mList
Array of spawnable entity names; exact meaning depends on sub-class implementation (e...
Definition: SpawnPointComponent.h:132
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
EMERGENCY 5 entities can spawn from this point. It has a list of valid entities which can spawn from ...
Definition: SpawnPointComponent.h:49
static Time fromSeconds(float seconds)
Definition: Time-inl.h:74
virtual bool isTransit() const
Definition: SpawnPointComponent.h:118
Prototype class.
Definition: Prototype.h:100
Binary serializer class.
Definition: BinarySerializer.h:35
static const uint32 COMPONENT_ID
"em5::SpawnPointComponent" unique component ID
Definition: SpawnPointComponent.h:57
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32