-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEventFilters.cs
More file actions
50 lines (44 loc) · 1.18 KB
/
EventFilters.cs
File metadata and controls
50 lines (44 loc) · 1.18 KB
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
45
46
47
48
49
50
using UnityEngine.Events;
namespace CustomAvatar
{
public class EveryNthComboFilter : EventFilterBehaviour
{
public int ComboStep = 50;
public UnityEvent NthComboReached;
private void OnEnable()
{
EventManager.OnComboChanged.AddListener(OnComboStep);
}
private void OnDisable()
{
EventManager.OnComboChanged.RemoveListener(OnComboStep);
}
private void OnComboStep(int combo)
{
if (combo % ComboStep == 0 && combo != 0)
{
NthComboReached.Invoke();
}
}
}
public class ComboReachedEvent : EventFilterBehaviour
{
public int ComboTarget = 50;
public UnityEvent NthComboReached;
private void OnEnable()
{
EventManager.OnComboChanged.AddListener(OnComboReached);
}
private void OnDisable()
{
EventManager.OnComboChanged.RemoveListener(OnComboReached);
}
private void OnComboReached(int combo)
{
if (combo == ComboTarget)
{
NthComboReached.Invoke();
}
}
}
}