Promoted SpawnerSystem to Engine
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#ifndef SpawnerSystem_h__
|
||||
#define SpawnerSystem_h__
|
||||
|
||||
#include <random>
|
||||
#include "Common.h"
|
||||
#include "GLM.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/ESpawnerSpawn.h"
|
||||
#include "Core/Transform.h"
|
||||
#include "Core/EntityFile.h"
|
||||
|
||||
class SpawnerSystem : public System
|
||||
{
|
||||
public:
|
||||
SpawnerSystem(SystemParams params);
|
||||
|
||||
// If dontCollideComponent is set, to e.g. "Player", then all the spawner
|
||||
// will try to pick a spawn location so that the spawned entity doesn't
|
||||
// collide with anything that has that component and is collidable.
|
||||
static EntityWrapper Spawn(EntityWrapper spawner, EntityWrapper parent = EntityWrapper::Invalid, const std::string& dontCollideComponent = "");
|
||||
|
||||
private:
|
||||
EventRelay<SpawnerSystem, Events::SpawnerSpawn> m_OnSpawnerSpawn;
|
||||
bool OnSpawnerSpawn(Events::SpawnerSpawn& e);
|
||||
static void transformEntityToSpawnPoint(EntityWrapper spawnedEntity, EntityWrapper spawnPoint);
|
||||
static bool spawnedEntityIsColliding(EntityWrapper spawnedEntity, EntityWrapper spawnPoint, const std::string& dontCollideComponent);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user