summaryrefslogtreecommitdiff
path: root/Runtime/Graphs/UnityEngine.Graphs/LogicNodeLibrary/Collider/OnTriggerEvent.cs
blob: 4be1fbcb2776ec1dcab412c47c29aa7e71379d1f (plain)
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
using UnityEngine;

namespace UnityEngine.Graphs.LogicGraph
{
	public partial class ColliderNodes
	{
		// This is only used for node declaration. Implementation is in the OnCollisionEventDummy monobehaviour.
		[Logic(typeof(Collider))]
		public class OnTriggerEvent
		{
			[LogicTarget]
			public Collider self;

			public Action enter;
			public Action exit;
			public Action stay;

			private Collider m_Other;

			public Collider other
			{
				get { return m_Other; }
			}

			internal void EnterDummy(Collider other)
			{
				if (enter == null)
					return;
				m_Other = other;
				enter();
			}
			internal void ExitDummy(Collider other)
			{
				if (exit == null)
					return;
				m_Other = other;
				exit();
			}
			internal void StayDummy(Collider other)
			{
				if (stay == null)
					return;
				m_Other = other;
				stay();
			}
		}
	}
}