Example #1
0
 public void Input(Collider2D other, TouchType touchType, CollisionType collisionType)
 {
     if (touchFilter.RequestActivate(other, touchType, collisionType) && tagFilter.Input(other))
     {
         response.Invoke(other);
     }
 }
Example #2
0
 void OnTriggerExit2D(Collider2D other)
 {
     if (isNodeActive)
     {
         _onTriggerExit.Invoke(other);
     }
 }
Example #3
0
 void OnTriggerStay2D(Collider2D other)
 {
     if (isNodeActive)
     {
         _onTriggerStay.Invoke(other);
     }
 }
 private void OnTriggerExit2D(Collider2D other)
 {
     if (IsCallTrigger(other.gameObject))
     {
         onTriggerExit?.Invoke(other);
     }
 }
Example #5
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (!activated)
     {
         return;
     }
     OnExit?.Invoke(collision);
 }
Example #6
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (!activated)
     {
         return;
     }
     OnStay?.Invoke(collision);
 }
Example #7
0
        void OnTriggerExit2D(Collider2D collider)
        {
            if (!IsTriggerable(collider))
            {
                return;
            }

            triggeed = true;
            if (OnExitTrigger2D != null)
            {
                OnExitTrigger2D.Invoke(collider);
            }
        }
Example #8
0
        void Update()
        {
            Vector2 pos = transform.position;
            Vector2 up  = transform.up;

            float half = angle / 2f;
            float step = angle / division;

            List <Collider2D> stayeds = new List <Collider2D>();
            List <Collider2D> exiteds = new List <Collider2D>(m_Colliders);

            for (float degree = -half; degree <= half; degree += step)
            {
                Vector2      p        = pos + Rotate(up, degree) * radius;
                RaycastHit2D hit      = Physics2D.Linecast(pos, p);
                Collider2D   collider = hit.collider;

                if (null != collider)
                {
                    if (!m_Colliders.Contains(collider))
                    {
                        m_Colliders.Add(collider);
                        onEnter.Invoke(collider);
                    }
                    else
                    {
                        exiteds.Remove(collider);

                        if (!stayeds.Contains(collider))
                        {
                            stayeds.Add(collider);
                            onStay.Invoke(collider);
                        }
                    }
                }
            }

            foreach (var exited in exiteds)
            {
                m_Colliders.Remove(exited);
                onExit.Invoke(exited);
            }

            exiteds.Clear();
        }
Example #9
0
    private void HandleGameEvent(EventTrigger gameEvent, object obj = null)
    {
        if (eventTrigger != gameEvent || ignoreEvent)
        {
            return;
        }

        switch (eventTrigger)
        {
        case EventTrigger.TriggerEnter:
        case EventTrigger.TriggerExit:
            colliderEvent.Invoke(obj as Collider);
            break;

        case EventTrigger.TriggerEnter2D:
        case EventTrigger.TriggerExit2D:
            collider2DEvent.Invoke(obj as Collider2D);
            break;

        case EventTrigger.CollisionEnter:
        case EventTrigger.CollisionExit:
            collisionEvent.Invoke(obj as Collision);
            break;

        case EventTrigger.CollisionEnter2D:
        case EventTrigger.CollisionExit2D:
            collision2DEvent.Invoke(obj as Collision2D);
            break;

        default:
            unityEvent.Invoke();
            break;
        }

        if (triggerOnce && gameEvent != EventTrigger.OnDestroy)
        {
            Destroy(this);
        }
    }
Example #10
0
 private void OnTriggerExit2D(Collider2D other)
 {
     _onTriggerExit2D.Invoke(other);
 }
Example #11
0
 public void Hit(GameObject gameObject, Collider2D collider)
 {
     OnHit.Invoke(gameObject, collider);
 }
Example #12
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     _onTriggerStay2D.Invoke(collision);
 }
 public virtual void Invoke(Collider2D data)
 {
     _callback.Invoke(data);
 }
 public void OnTriggerExit2D(Collider2D collider)
 {
     Debug.Log(collider.name + " has exit " + transform.parent.name + " - " + gameObject.name);
     TriggerExit2D.Invoke(collider);
 }
 public void OnTriggerStay2D(Collider2D collider)
 {
     TriggerStay2D.Invoke(collider);
 }