-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTrigger.h
44 lines (30 loc) · 845 Bytes
/
Trigger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "Mesh.h"
#include "Physics.h"
#include <functional>
#include <algorithm>
typedef std::function<void(void)> CallbackFunc;
enum CallbackType { Enter, Stay, Leave };
class GameObject;
class Trigger //: public Component
{
public:
bool bTriggered = false;
std::vector<CallbackFunc> onEnterCallbacks;
std::vector<CallbackFunc> onStayCallbacks;
std::vector<CallbackFunc> onLeaveCallbacks;
bool bEnabled = false; //When component won't need this
//For specific behaviours
std::vector<int> connectionIDs;
bool bDeadly = false;
bool bLoopy = false;
Trigger(){}
~Trigger(){}
void RegisterCallback(CallbackFunc callback, CallbackType type);
void OnEnter();
void OnStay();
void OnLeave();
//For specific behaviour
void LinkToPlatform(GameObject* platform,
GameObject* button, bool loading = false);
};