#pragma once #include // TODO: make life cycle object class. // objects from that class can be created and destroyed only through factory // methods which create updates too. namespace game { class StateUpdateEvent { public: enum class LifeCycle { Create, // something was created Modify, // something was modified (look at attributes) Destroy // something was destroyed }; // add all possible classes here enum class EventType { Explosion }; StateUpdateEvent(LifeCycle cycle, EventType event) : m_lifeCycle(cycle), m_eventType(event) { } LifeCycle lifeCycle() const { return m_lifeCycle; } EventType eventType() const { return m_eventType; } std::string description() const { // TODO return ""; } static std::string lifeCycleToString(LifeCycle lifeCycle) { switch(lifeCycle) { case StateUpdateEvent::LifeCycle::Create: return "create"; case StateUpdateEvent::LifeCycle::Modify: return "modify"; case StateUpdateEvent::LifeCycle::Destroy: return "destroy"; default: return ""; } } private: const LifeCycle m_lifeCycle; const EventType m_eventType; }; }