3#include <Core/Prefabs/PrefabResource.h>
4#include <Core/World/Component.h>
5#include <Core/World/ComponentManager.h>
11 using StorageType = plUInt16;
24 StorageType SpawnAtStart : 1;
63 void SetHalfExtents(
const plVec3& value);
64 const plVec3& GetHalfExtents()
const {
return m_vHalfExtents; }
66 void SetPrefabFile(
const char* szFile);
67 const char* GetPrefabFile()
const;
69 bool GetSpawnAtStart()
const;
70 void SetSpawnAtStart(
bool b);
72 bool GetSpawnContinuously()
const;
73 void SetSpawnContinuously(
bool b);
76 plUInt16 m_uiMinSpawnCount = 5;
77 plUInt16 m_uiSpawnCountRange = 5;
89 void Spawn(plUInt32 uiCount);
90 void InternalStartSpawning(
bool bFirstTime);
92 plUInt16 m_uiSpawned = 0;
93 plUInt16 m_uiTotalToSpawn = 0;
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
Base class of all component types.
Definition Component.h:25
Definition ComponentManager.h:88
This component spawns prefabs inside a box.
Definition SpawnBoxComponent.h:41
virtual void OnSimulationStarted() override
This method is called once for active components, at the start of the next world update,...
Definition SpawnBoxComponent.cpp:127
plAngle m_MaxRotationZ
The spawned object's forward direction may deviate this amount from the spawn box's forward rotation....
Definition SpawnBoxComponent.h:81
plAngle m_MaxTiltZ
The spawned object's Z (up) axis may deviate by this amount from the spawn box's Z axis.
Definition SpawnBoxComponent.h:84
virtual void DeserializeComponent(plWorldReader &inout_stream) override
Override this to load the current state of the component from the given stream.
Definition SpawnBoxComponent.cpp:112
void StartSpawning()
When called, the component starts spawning the chosen number of prefabs over the set duration.
Definition SpawnBoxComponent.cpp:137
virtual void SerializeComponent(plWorldWriter &inout_stream) const override
Override this to save the current state of the component to the given stream.
Definition SpawnBoxComponent.cpp:97
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
For internal use by components to trigger some known behavior. Usually components will post this mess...
Definition TriggerMessage.h:26
Definition SpawnBoxComponent.h:23
Definition SpawnBoxComponent.h:10
Enum
Definition SpawnBoxComponent.h:14
@ SpawnContinuously
Every time a spawn duration has finished, a new one is started.
Definition SpawnBoxComponent.h:17
@ SpawnAtStart
The component will schedule a spawn once at creation time.
Definition SpawnBoxComponent.h:16
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12