Esempio n. 1
0
 public void Invoke()
 {
     if (_event != null)
     {
         _event.Invoke();
     }
 }
Esempio n. 2
0
 // NOT called when SetValueSilent is called
 protected virtual void OnChanged(T oldValue, T newValue)
 {
     if (valueChanged != null)
     {
         valueChanged.Invoke(newValue);
     }
 }
Esempio n. 3
0
 void Update()
 {
     while (Interval > 0 && Time.time >= nextTime)
     {
         fire.Invoke();
         nextTime += Interval;
     }
 }
Esempio n. 4
0
 void Update()
 {
     if (Input.GetButtonDown(Button) && down != null)
     {
         down.Invoke();
     }
     if (Input.GetButtonUp(Button) && up != null)
     {
         up.Invoke();
     }
 }
Esempio n. 5
0
 public void Test()
 {
     if (Value && True != null)
     {
         True.Invoke();
     }
     else if (!Value && False != null)
     {
         False.Invoke();
     }
 }
Esempio n. 6
0
 void Update()
 {
     if (Input.GetKeyDown(Key) && down != null)
     {
         down.Invoke();
     }
     if (Input.GetKeyUp(Key) && up != null)
     {
         up.Invoke();
     }
 }
Esempio n. 7
0
 public bool CheckCorrectItem(BasicItem item)
 {
     if (item?.Kind != RequiredItem)
     {
         OnWrongItem.Invoke();
         return(false);
     }
     else
     {
         OnToggle.Invoke();
         return(true);
     }
 }
Esempio n. 8
0
    public void Test(GameObject gameObject)
    {
        bool match = Matches(gameObject);

        if (match && pass != null)
        {
            pass.Invoke(gameObject);
        }
        else if (!match && fail != null)
        {
            fail.Invoke(gameObject);
        }
    }
Esempio n. 9
0
    public bool Raycast()
    {
        bool raycastHit = Physics.Raycast(transform.position, transform.forward,
                                          out RaycastHit hitInfo, MaxDistance, Mask, triggerInteraction);

        if (raycastHit && hit != null)
        {
            hit.Invoke(hitInfo.transform);  // uses rigidbody if available
        }
        else if (!raycastHit && miss != null)
        {
            miss.Invoke();
        }
        return(raycastHit);
    }
Esempio n. 10
0
    private void CollisionEnter(Collider c)
    {
        if (!enabled)
        {
            return;
        }
        GameObject o = c.gameObject;

        if (ColliderMatches(c) && touching.Add(o))
        {
            if (startTouch != null)
            {
                startTouch.Invoke(o);
            }
            if (touching.Count == 1 && startTouchAll != null)
            {
                startTouchAll.Invoke(o);
            }
        }
    }
Esempio n. 11
0
    private void StateChange(CounterState oldState, CounterState newState)
    {
        if (newState.atMin && !oldState.atMin && hitMin != null)
        {
            hitMin.Invoke();
        }
        else if (!newState.atMin && oldState.atMin && changedFromMin != null)
        {
            changedFromMin.Invoke();
        }

        if (newState.atMax && !oldState.atMax && hitMax != null)
        {
            hitMax.Invoke();
        }
        else if (!newState.atMax && oldState.atMax && changedFromMax != null)
        {
            changedFromMax.Invoke();
        }
    }
Esempio n. 12
0
    void Update()
    {
        bool isPlaying;

        if (AnimationName == null || AnimationName == "")
        {
            isPlaying = animation.isPlaying;
        }
        else
        {
            isPlaying = animation.IsPlaying(AnimationName);
        }

        if (isPlaying && !wasPlaying)
        {
            start.Invoke();
        }
        if (!isPlaying && wasPlaying)
        {
            complete.Invoke();
        }
        wasPlaying = isPlaying;
    }
Esempio n. 13
0
 /// <summary>Invokes <see cref="_disableEvent"/>.</summary>
 public virtual void OnDisable()
 {
     _disableEvent?.Invoke();
 }
Esempio n. 14
0
 /// <summary>Invokes <see cref="_enableEvent"/>.</summary>
 public virtual void OnEnable()
 {
     _enableEvent?.Invoke();
 }