feat: implement contact listeners
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
#define LIGHTKEEPER_GAMECOMPONENTLIST_H
|
||||
|
||||
#include <components/PrintComponent.h>
|
||||
#include <components/TriggerLoggerComponent.h>
|
||||
|
||||
#define LIGHTKEEPER_GAME_COMPONENTS(X) \
|
||||
X(PrintComponent)
|
||||
X(PrintComponent) \
|
||||
X(TriggerLoggerComponent)
|
||||
|
||||
#endif // LIGHTKEEPER_GAMECOMPONENTLIST_H
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef DESTRUM_TRIGGERLOGGERCOMPONENT_H
|
||||
#define DESTRUM_TRIGGERLOGGERCOMPONENT_H
|
||||
#include "destrum/ObjectModel/Component.h"
|
||||
|
||||
class TriggerLoggerComponent: public Component {
|
||||
public:
|
||||
TriggerLoggerComponent(GameObject& parent);
|
||||
|
||||
std::string GetTypeName() const override { return "TriggerLoggerComponent"; }
|
||||
|
||||
void OnTriggerEnter(GameObject* other) override;
|
||||
void OnTriggerExit(GameObject* other) override;
|
||||
|
||||
nlohmann::json Serialize() const override;
|
||||
void Deserialize(const nlohmann::json&) override;
|
||||
|
||||
int triggerEnterCount{0};
|
||||
int triggerExitCount{0};
|
||||
std::string lastOtherName;
|
||||
};
|
||||
|
||||
#endif //DESTRUM_TRIGGERLOGGERCOMPONENT_H
|
||||
Reference in New Issue
Block a user