change timers to not use ptrs (#1399)

add comments as to why logic may seem confusing.
This commit is contained in:
David Markowitz
2024-01-06 01:45:23 -08:00
committed by GitHub
parent 325598cd99
commit 14c20fbd62
6 changed files with 67 additions and 78 deletions

View File

@@ -160,6 +160,8 @@ public:
void AddChild(Entity* child);
void RemoveChild(Entity* child);
void RemoveParent();
// Adds a timer to start next frame with the given name and time.
void AddTimer(std::string name, float time);
void AddCallbackTimer(float time, std::function<void()> callback);
bool HasTimer(const std::string& name);
@@ -324,9 +326,10 @@ protected:
std::vector<std::function<void(Entity* target)>> m_PhantomCollisionCallbacks;
std::unordered_map<eReplicaComponentType, Component*> m_Components;
std::vector<EntityTimer*> m_Timers;
std::vector<EntityTimer*> m_PendingTimers;
std::vector<EntityCallbackTimer*> m_CallbackTimers;
std::vector<EntityTimer> m_Timers;
std::vector<EntityTimer> m_PendingTimers;
std::vector<EntityCallbackTimer> m_CallbackTimers;
std::vector<EntityCallbackTimer> m_PendingCallbackTimers;
bool m_ShouldDestroyAfterUpdate = false;