Eventbaserade partiklar. Fick nån krasch i physicssystem efter ett tags spelande, men det hoppas jag löser sig när jag mergar in Viktors senaste fysikfixar :3
This commit is contained in:
@@ -18,6 +18,7 @@ struct ParticleEmitter : public Component
|
||||
float EmittingAngle = 0.f;
|
||||
float Spread = 0.f;
|
||||
float Speed = 2.f;
|
||||
double LifeTime = 100;
|
||||
|
||||
//ParticleSystem variables
|
||||
float GravityScale = 1.0f;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef EVENTS_ECREATEPARTICLESEQUENCE_H__
|
||||
#define EVENTS_ECREATEPARTICLESEQUENCE_H__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Physics/CParticle.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct CreateParticleSequence : public Event
|
||||
{
|
||||
//Emitter
|
||||
double EmitterLifeTime = 100;
|
||||
glm::vec3 Position = glm::vec3(0);
|
||||
float GravityScale = 0.f;
|
||||
float SpawnRate = 1.f;
|
||||
int NumberOfTicks = 100;
|
||||
float Speed = 1.f;
|
||||
int ParticlesPerTick = 1.f;
|
||||
float Spread = glm::pi<float>();
|
||||
float EmittingAngle = glm::two_pi<float>();
|
||||
float MaxCount = 0;
|
||||
|
||||
//Particle
|
||||
std::string SpriteFile = "Texures/Core/ErrorTexture.png";
|
||||
double ParticleLifeTime = 3.f;
|
||||
ParticleFlags::Type Flags = ParticleFlags::Type::powderParticle | ParticleFlags::Type::particleContactFilterParticle | ParticleFlags::Type::fixtureContactFilterParticle;
|
||||
float Radius = 1.f;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Transform/TransformSystem.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Physics/ESetImpulse.h"
|
||||
#include "Physics/ECreateParticleSequence.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Game/CPad.h"
|
||||
@@ -47,6 +48,9 @@ public:
|
||||
EventRelay<PhysicsSystem, Events::SetImpulse> m_SetImpulse;
|
||||
bool SetImpulse(const Events::SetImpulse &event);
|
||||
|
||||
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
|
||||
bool CreateParticleSequence(const Events::CreateParticleSequence &event);
|
||||
|
||||
void RegisterComponents(ComponentFactory* cf) override;
|
||||
void Initialize() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user