f632b45c9b
# Conflicts: # include/Engine/Rendering/Model.h # src/Engine/Collision/Collision.cpp # src/Engine/Collision/CollisionSystem.cpp # src/Engine/Collision/TriggerSystem.cpp # src/Game/Systems/SpawnerSystem.cpp
31 lines
1.3 KiB
C++
31 lines
1.3 KiB
C++
#ifndef SpawnerSystem_h__
|
|
#define SpawnerSystem_h__
|
|
|
|
#include <random>
|
|
#include "Common.h"
|
|
#include "GLM.h"
|
|
#include "Core/System.h"
|
|
#include "Events/ESpawnerSpawn.h"
|
|
#include "Core/TransformSystem.h"
|
|
#include "Core/EntityFile.h"
|
|
#include "Rendering/Model.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 = "");
|
|
static EntityWrapper SpawnEntityFile(const std::string& entityFilePath, 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 |