Exemple #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();
     }
 }
Exemple #4
0
 public virtual void Open()
 {
     print("Triggerable [" + name + "] opened!");
     if (open != null)
     {
         open.Invoke();
     }
 }
Exemple #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);
     }
 }
Exemple #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);
         }
     }
 }
Exemple #8
0
        public virtual void OnDrag(PointerEventData eventData)
        {
            if (!IsInteractable())
            {
                return;
            }

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

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

            current = this;
            UIEventTrigger.eventData = eventData;
            if (onUpdateSelected != null)
            {
                onUpdateSelected.Invoke(this);
            }
        }
Exemple #11
0
 private void OnTriggerEnter(Collider other)
 {
     TriggerAction?.Invoke(other.gameObject.GetHashCode());
     FXTriggerAction?.Invoke(other.transform.position);
     _gameController.GameCanvas.AddScoreInText();
 }
 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);
 }
Exemple #14
0
 private void OnTriggerEnter(Collider other)
 {
     _triggerCount++;
     onTrigger.Invoke(true, other);
 }
Exemple #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);
 }
 private void OnTriggerExit(Collider other)
 {
     TriggerAction?.Invoke(other.gameObject.GetHashCode());
 }