private void Update()
 {
     if (State == InteractState.Grabbed)
     {
         door?.SetByHandPosition(hand);
         Events.FireEvent(EventType.HandleGrabbed, CallbackData.NoData());
     }
 }
예제 #2
0
    private static void CallDefaultCallbacks(EventType type, CallbackData?data = null)
    {
        try {
            if (!eventsData.ContainsKey(type))
            {
                return;
            }

            (eventsData[type] as EventDataCallback)?.Invoke(data ?? CallbackData.NoData());
        } catch (Exception e) {
            Logger.Error("Failed to execute event callbacks: " + e.Message + "\n\nError stack trace:\n" + e.StackTrace + "\n\n");
        }
    }
예제 #3
0
 /// <summary>
 /// Calls all callbacks for event
 /// </summary>
 /// <param name="type"></param>
 public static void FireEvent(EventType type)
 {
     CallDefaultCallbacks(type);
     CallComponentCallbacks(type, CallbackData.NoData());
 }