Exemple #1
0
        /// <summary>
        /// Guess what? This triggers the trigger :)
        /// </summary>
        public void TriggerTheTrigger(string triggerValue)
        {
            if (triggerOnGameEvent)
            {
                if (gameEvent.Equals(triggerValue) || dispatchAll)
                {
                    onTriggerEvent.Invoke(triggerValue);

                    if (gameEvents != null && gameEvents.Count > 0)
                    {
                        UIManager.SendGameEvents(gameEvents);
                    }
                }
            }
            else if (triggerOnButtonClick)
            {
                if (buttonName.Equals(triggerValue) || dispatchAll)
                {
                    onTriggerEvent.Invoke(triggerValue);

                    if (gameEvents != null && gameEvents.Count > 0)
                    {
                        UIManager.SendGameEvents(gameEvents);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Triggers the UITrigger to execute its actions.
        /// </summary>
        public void TriggerTheTrigger(string triggerValue)
        {
            if (triggerOnGameEvent)
            {
                if (gameEvent.Equals(triggerValue) || dispatchAll)
                {
                    onTriggerEvent.Invoke(triggerValue);

                    if (gameEvents != null && gameEvents.Count > 0)
                    {
                        StartCoroutine(SendGameEventsInTheNextFrame());
                    }
                }
            }
            else if (triggerOnButtonClick || triggerOnButtonDoubleClick || triggerOnButtonLongClick)
            {
                if (buttonName.Equals(triggerValue) || dispatchAll)
                {
                    onTriggerEvent.Invoke(triggerValue);

                    if (gameEvents != null && gameEvents.Count > 0)
                    {
                        StartCoroutine(SendGameEventsInTheNextFrame());
                    }
                }
            }
        }
Exemple #3
0
 //------------------------------------------------------------------------------------------------
 public void OnAction()
 {
     if (myNextState == State.ENTER && type == Type.ACTION)
     {
         myNextState = State.EXIT;
         onEvent.Invoke(this);
     }
 }
Exemple #4
0
 //------------------------------------------------------------------------------------------------
 public void OnActionEnd()
 {
     if (myNextState == State.EXIT && type == Type.ACTION)
     {
         myNextState = (canRepeat ? State.ENTER : State.DONE);
         onEventEnd.Invoke(this);
     }
 }
Exemple #5
0
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player")
     {
         triggerEvent.Invoke(other.gameObject);
     }
 }
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (_onTriggerEnterEvent.IsAssigned())
     {
         _onTriggerEnterEvent.Invoke(other);
     }
 }
 void Invoke(GameObject other)
 {
     foreach (var trigger in triggers)
     {
         TriggerEvent?.Invoke(this, new TriggerEventArgs(trigger.Target, trigger.SpecifiedTargetItem, other.gameObject, trigger.Key, trigger.Type, trigger.Value));
     }
 }
 void Invoke()
 {
     if (Lottery.TryGetWeightRandom(choices, c => c.Weight, out var result))
     {
         TriggerEvent?.Invoke(new TriggerEventArgs(result.Triggers));
     }
 }
Exemple #9
0
 public void Invoke(bool isDown)
 {
     foreach (var trigger in isDown ? downTriggers : upTriggers)
     {
         TriggerEvent?.Invoke(this, new TriggerEventArgs(trigger.Target, trigger.SpecifiedTargetItem, null, trigger.Key, trigger.Type, trigger.Value));
     }
 }
Exemple #10
0
        /// <summary>
        /// Updates alarm. Returns true, if alarm was triggered.
        /// </summary>
        public bool Update()
        {
            if (!Paused && Running)
            {
                Counter += TimeKeeper.Time();

                if (
                    OnTriggerAction != OnTriggerAction.None &&
                    Counter >= TriggerTime
                    )
                {
                    if (OnTriggerAction == OnTriggerAction.Stop)
                    {
                        Running = false;
                        Counter = 0;
                    }
                    if (OnTriggerAction == OnTriggerAction.Loop)
                    {
                        Counter -= TriggerTime;                         // Necessary for correct timing.
                    }
                    TriggerEvent?.Invoke(this);
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Triggers the enter event
        /// </summary>
        /// <param name="gameObjectEntering">The object entering</param>
        public void TriggerEnterEvent(GameObject gameObjectEntering)
        {
            BaseEventData eventData = new BaseEventData(EventSystem.current);

            eventData.selectedObject = gameObjectEntering;
            enterEvent.Invoke(eventData);
        }
Exemple #12
0
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player")
     {
         stay.Invoke();
     }
 }
Exemple #13
0
    public override bool Use()
    {
        if (Time.time - lastShootTime < shootTime)
        {
            return(false);
        }
        if (Time.time - lastReloadTime < reloadTime)
        {
            return(false);
        }


        if (!CheckBullets())
        {
            if (EmptyMagasinEvent != null)
            {
                EmptyMagasinEvent.Invoke(this);
            }
            if (autoReload)
            {
                Reload();
            }

            return(false);
        }
        if (TriggerEvent != null)
        {
            TriggerEvent.Invoke(this);
        }

        lastShootTime = Time.time;
        return(true);
    }
Exemple #14
0
 void Invoke()
 {
     foreach (var trigger in triggers)
     {
         TriggerEvent?.Invoke(this, new TriggerEventArgs(trigger.Target, trigger.SpecifiedTargetItem, null, trigger.Key, trigger.Type, trigger.Value));
     }
 }
    void OnTriggerExit(Collider _other)
    {
        bool isCollided = false;

        if (filterTags.Length <= 0)
        {
            isCollided = true;
        }

        foreach (string tag in filterTags)
        {
            if (_other.CompareTag(tag))
            {
                isCollided = true;
            }
        }

        if (!isCollided)
        {
            return;
        }

        if (OnExit != null)
        {
            OnExit.Invoke(_other);
        }
    }
Exemple #16
0
 private void OnTriggerExit(Collider other)
 {
     if (other.tag == "Player")
     {
         Hide.Invoke();
     }
 }
Exemple #17
0
 private void OnTriggerExit(Collider collider)
 {
     if (!m_ignoreColliders.Contains(collider))
     {
         onTriggerExit.Invoke(collider);
     }
 }
Exemple #18
0
 private void OnTriggerStay(Collider col)
 {
     if (col.CompareTag(tagToDetect))
     {
         onTriggerStayEvent.Invoke(m_col, GoalValue);
     }
 }
Exemple #19
0
 public void OnDrag(PointerEventData eventData)
 {
     if (m_Delegate != null)
     {
         m_Delegate.Invoke(eventData);
     }
 }
Exemple #20
0
 private void OnTriggerExit(Collider col)
 {
     if (col.CompareTag(tagToDetect))
     {
         onTriggerExitEvent.Invoke(col);
     }
 }
Exemple #21
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         Show.Invoke();
     }
 }
Exemple #22
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         goalReached.Invoke(this);
     }
 }
Exemple #23
0
 void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         Hide.Invoke();
     }
 }
 private void OnTriggerExit(Collider other)
 {
     if (CanTrigger(other.gameObject))
     {
         OnExit?.Invoke(other);
     }
 }
Exemple #25
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         Show.Invoke();
     }
 }
Exemple #26
0
 private void OnTriggerEnter(Collider other)
 {
     if ((1 << other.gameObject.layer) == mask)
     {
         onTriggerEnter?.Invoke(other);
     }
 }
 private void OnTriggerExit(Collider other)
 {
     if (_onTriggerExitEvent.IsAssigned())
     {
         _onTriggerExitEvent.Invoke(other);
     }
 }
Exemple #28
0
 public virtual void OnTrigger()
 {
     TriggerEvent?.Invoke(Durability);
     if (Durability <= 0 && IdleAnimation != null)
     {
         transform.root.GetComponentInChildren <Animator>().SetBool(IdleAnimation, false);
     }
 }
Exemple #29
0
 void OnTriggerExit(Collider other)
 {
     //Debug.Log("Trigger exit " + transform.parent.gameObject.name + ": " + other.gameObject.name);
     if ((layerMask.value & 1 << other.gameObject.layer) != 0)
     {
         onTriggerExit.Invoke(other);
     }
 }
Exemple #30
0
 private void OnTriggerStay(Collider other)
 {
     //Debug.Log("Trigger stay " + transform.parent.gameObject.name + ": " + other.gameObject.name);
     if ((layerMask.value & 1 << other.gameObject.layer) != 0)
     {
         onTriggerStay.Invoke(other);
     }
 }