コード例 #1
0
        public void OnTriggerExit2D(Collider2D other)
        {
            ISnapable snapable = other.GetComponent <ISnapable>();

            if (snapable == null)
            {
                return;
            }

            _snapable?.UnHighlight();

            if (_snapable != snapable)
            {
                return;
            }

            _snapable       = null;
            _snapableOffset = null;
        }
コード例 #2
0
        public void OnTriggerStay2D(Collider2D other)
        {
            if (_snapable != null)
            {
                return;
            }

            ISnapable snapable = other.GetComponent <ISnapable>();

            if (snapable == null)
            {
                return;
            }

            if (_snapable != null && _snapable != snapable)
            {
                _snapable.UnHighlight();
            }

            snapable.Highlight();
            _snapable = snapable;
        }