Esempio n. 1
0
        public void UpdateTrigger(InputHelpers.Button button, AsimState state, TriggerAction action)
        {
            var(controller, ray) = GetCurrent();
            switch (state)
            {
            case AsimState.Down:
                if (GetTriggerDown(button))
                {
                    action?.Invoke(controller, ray);
                }
                break;

            case AsimState.Hold:
                if (GetTrigger(button))
                {
                    action?.Invoke(controller, ray);
                }
                break;

            case AsimState.Up:
                if (GetTriggerUp(button))
                {
                    action?.Invoke(controller, ray);
                }
                break;
            }
        }
 void OnPowerOn()
 {
     if (powerOnAction != null)
     {
         powerOnAction.Invoke();
     }
 }
 void OnPowerOff()
 {
     if (powerOffAction != null)
     {
         powerOffAction.Invoke();
     }
 }
Esempio n. 4
0
 public virtual void Open()
 {
     print("Triggerable [" + name + "] opened!");
     if (open != null)
     {
         open.Invoke();
     }
 }
Esempio n. 5
0
 public virtual void Close()
 {
     print("Triggerable [" + name + "] closed!");
     if (close != null)
     {
         close.Invoke();
     }
 }
 // -------------------------------------------------------------------------
 private void OnTriggerExit2D(Collider2D otherCollider)
 {
     // If after all our checks, this was a valid trigger...
     if (IsTriggerValid(otherCollider) == true)
     {
         // Inform our listening actions that the trigger ended
         onTriggerExitActions.Invoke(otherCollider.gameObject);
     }
 }
Esempio n. 7
0
 public void UpdateTrigger(InputHelpers.Button button, AsimState state, TriggerAction action)
 {
     foreach (var controller in m_controllers)
     {
         if (controller.IsActive(button, state))
         {
             action.Invoke(controller.Controller, controller.Ray);
         }
     }
 }
Esempio n. 8
0
        public virtual void OnDrag(PointerEventData eventData)
        {
            if (!IsInteractable())
            {
                return;
            }

            current = this;
            UIEventTrigger.eventData = eventData;
            if (onDrag != null)
            {
                onDrag.Invoke(this);
            }
        }
Esempio n. 9
0
        public virtual void OnSubmit(BaseEventData eventData)
        {
            if (!IsInteractable())
            {
                return;
            }

            current = this;
            UIEventTrigger.eventData = eventData;
            if (onSubmit != null)
            {
                onSubmit.Invoke(this);
            }
        }
Esempio n. 10
0
        public virtual void OnUpdateSelected(BaseEventData eventData)
        {
            if (!IsInteractable())
            {
                return;
            }

            current = this;
            UIEventTrigger.eventData = eventData;
            if (onUpdateSelected != null)
            {
                onUpdateSelected.Invoke(this);
            }
        }
Esempio n. 11
0
 private void OnTriggerEnter(Collider other)
 {
     TriggerAction?.Invoke(other.gameObject.GetHashCode());
     FXTriggerAction?.Invoke(other.transform.position);
     _gameController.GameCanvas.AddScoreInText();
 }
Esempio n. 12
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     OnTriggerAction?.Invoke(collision, true);
 }
 /// <summary>
 /// Invokes a <see cref="TriggerAction"/>.
 /// </summary>
 /// <param name="action">The <see cref="TriggerAction"/>.</param>
 public static void Invoke(this TriggerAction action)
 {
     action.Invoke(null);
 }
Esempio n. 14
0
 private void OnTriggerEnter(Collider other)
 {
     _triggerCount++;
     onTrigger.Invoke(true, other);
 }
Esempio n. 15
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     TriggerAction.Invoke(other.gameObject);
 }
 /// <summary>
 /// Invokes a <see cref="TriggerAction"/> with the specified parameter.
 /// </summary>
 /// <param name="action">The <see cref="TriggerAction"/>.</param>
 /// <param name="parameter">The parameter value.</param>
 public static void Invoke(this TriggerAction action, object parameter)
 {
     action.Invoke(null);
 }
Esempio n. 17
0
 private void OnTriggerExit(Collider other)
 {
     TriggerAction?.Invoke(other.gameObject.GetHashCode());
 }