-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointOnSurfaceEventReceiver.cs
More file actions
39 lines (35 loc) · 1.25 KB
/
PointOnSurfaceEventReceiver.cs
File metadata and controls
39 lines (35 loc) · 1.25 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PointOnSurfaceEventReceiver : MonoBehaviour
{
private void OnEnable()
{
hom3r.coreLink.SubscribeEventObserver(DoInternalEventCommand); //Subscribe a method to the event delegate
}
private void OnDisable()
{
hom3r.coreLink.UnsubscribeEventObserver(DoInternalEventCommand); //Unsubscribe a method to the event delegate
}
private void DoInternalEventCommand(CCoreEvent _event)
{
if (_event.GetType() == typeof(CCoreEvent)) { ExecuteCoreEvents(_event); }
else { /* Do nothing */ }
}
/// <summary>Execute internal events commands</summary>
/// <param name="_event">command to be executed</param>
private void ExecuteCoreEvents(CCoreEvent _event)
{
if (_event.data != null)
{
switch (_event.data.commandEvent)
{
case TCoreEvent.MouseManager_LeftButtonUp:
hom3r.quickLinks.scriptsObject.GetComponent<PointOnSurfaceManager>().CapturePointOnSurface(_event.data.mousePosition, _event.data.obj);
break;
default:
break;
}
}
}
}