コード例 #1
0
 public void UnregisterListener(GameEventListenerTransform listener)
 {
     if (eventListeners.Contains(listener))
     {
         eventListeners.Remove(listener);
     }
 }
コード例 #2
0
 public void RegisterListener(GameEventListenerTransform listener)
 {
     if (!eventListeners.Contains(listener))
     {
         eventListeners.Add(listener);
     }
 }
コード例 #3
0
ファイル: VRUISetup.cs プロジェクト: VRUN-Game/VRUN
 /// <summary>
 /// Check if the listener passed as reference exist, disable and unregister it if it's the case.
 /// </summary>
 /// <param name="listener">The listener to check and disable</param>
 /// <param name="gameEvent">the GameEvent that Registered the listener at runtime</param>
 /// <returns>The Listener after being disabled</returns>
 public GameEventListenerTransform DeactivateListener(GameEventListenerTransform listener, GameEventTransform gameEvent)
 {
     if (listener)
     {
         gameEvent.UnregisterListener(listener);
         listener.OnDisable();
     }
     return(listener);
 }
コード例 #4
0
ファイル: VRUISetup.cs プロジェクト: VRUN-Game/VRUN
        /// <summary>
        /// Set the Event and response of the GameEventListeners passed in parameter, and register it int he gameEvent corresponding
        /// A GameEventListenerTransform is used as we check the transfrom of the object that was clicked
        /// </summary>
        /// <param name="gameEvent">The game Event to listen to</param>
        /// <param name="listener">The listener of the gameEvent that need to be set</param>
        /// <returns>The new version of the GameEventListenerTransform</returns>
        public GameEventListenerTransform SetGameEventClickListener(GameEventTransform gameEvent, GameEventListenerTransform listener)
        {
            listener.Event    = gameEvent;
            listener.Response = new ScriptableFramework.Events.UnityEvents.EventTransform();

            // Add the listener to the gameEvent if it wasn't there yet
            if (!gameEvent.GetListeners().Contains(listener))
            {
                gameEvent.RegisterListener(listener);
            }

            if (listener.Event.name.ToLower().Contains("click"))
            {
                listener.Response.AddListener(delegate { _CheckObjectClick(listener.Value); });
            }
            else
            {
                listener.Response.AddListener(delegate { _CheckObjectOver(listener.Value); });
            }

            return(listener);
        }