event stuff working again. a bit too much boiler plate code but functionality counts.

This commit is contained in:
Andreas Ortmann 2016-10-03 13:37:49 +02:00
parent 2d0608b205
commit becf8602d7
18 changed files with 235 additions and 149 deletions

View file

@ -6,16 +6,9 @@
namespace game {
class ExplosionEvent : public StateUpdateEvent {
public:
ExplosionEvent(StateUpdateEvent::LifeCycle lifeCycle, Explosion *explosion)
: StateUpdateEvent(lifeCycle, StateUpdateEvent::EventType::Explosion)
, explosion(explosion)
ExplosionEvent(LifeCycle lifeCycle, Explosion *explosion)
: StateUpdateEvent(lifeCycle, EventType::Explosion, explosion)
{
std::string typeStr = StateUpdateEvent::lifeCycleToString(lifeCycle);
std::cout<<"created explosion event for id " << explosion->id << " of type " << typeStr << std::endl;
}
public:
const Explosion *explosion;
};
}

View file

@ -0,0 +1,14 @@
#pragma once
#include "state/missile.hpp"
#include "state/state_update_event.hpp"
namespace game {
class MissileEvent : public StateUpdateEvent {
public:
MissileEvent(LifeCycle lifeCycle, Missile *missile)
: StateUpdateEvent(lifeCycle, EventType::Missile, missile)
{
}
};
}

View file

@ -0,0 +1,14 @@
#pragma once
#include "state/ship.hpp"
#include "state/state_update_event.hpp"
namespace game {
class ShipEvent : public StateUpdateEvent {
public:
ShipEvent(LifeCycle lifeCycle, Ship *ship)
: StateUpdateEvent(lifeCycle, EventType::Ship, ship)
{
}
};
}