예제 #1
0
 public static void CancelClick()
 {
     if (active != null)
     {
         active.canceled   = true;
         active.isPressing = false;
         active            = null;
     }
 }
예제 #2
0
    void OnSceneGUI()
    {
        KinectButton kinectButton = target as KinectButton;

        Handles.color = Color.red;
        Handles.DrawWireDisc(kinectButton.transform.position, Vector3.forward, kinectButton.radius);

        EditorGUI.BeginChangeCheck();
        kinectButton.radius = Handles.ScaleValueHandle(kinectButton.radius, kinectButton.transform.position + new Vector3(-kinectButton.radius, 0, 0), Quaternion.identity, 2, Handles.CylinderCap, 2);
    }
예제 #3
0
 private void OnTouchEnter(KinectButton button, JointId bone)
 {
     _particles.Play();
 }
예제 #4
0
 private void Awake()
 {
     _button = gameObject.GetComponent <KinectButton>();
     _button.OnTouchEnter += OnTouchEnter;
 }
예제 #5
0
    private static bool IsTouching(BoneState bone, KinectButton button)
    {
        const float threshold = 0.4f;

        return(math.distance(bone.position, button.transform.position) < threshold);
    }
예제 #6
0
    void ValidateEvents()
    {
        if (isHovering)
        {
            OnPersistentHovering();

            if (canceled)
            {
                return;
            }

            if (cursorState != CursorState.Up)
            {
                if (!isDragging)
                {
                    if (!wasHovering)
                    {
                        OnHoverEnter();

                        if (canceled)
                        {
                            return;
                        }
                    }
                    else
                    {
                        OnHoverStay();

                        if (canceled)
                        {
                            return;
                        }
                    }
                }

                if (cursorState == CursorState.Down)
                {
                    active     = this;
                    isPressing = true;
                }
            }
        }
        else if (wasHovering)
        {
            if (cursorState == CursorState.None)
            {
                OnNormal();

                if (canceled)
                {
                    return;
                }
            }

            OnHoverExit();

            if (canceled)
            {
                return;
            }
        }

        if (isPressing)
        {
            if (isDragging)
            {
                if (!wasDragging)
                {
                    OnDraggingStarted();

                    if (canceled)
                    {
                        return;
                    }
                }
                else if (!isHovering)
                {
                    OnOutsideDragging();

                    if (canceled)
                    {
                        return;
                    }
                }
                else
                {
                    OnDragging();

                    if (canceled)
                    {
                        return;
                    }
                }
            }

            if (isHovering)
            {
                if (cursorState == CursorState.Down)
                {
                    OnPreClick();

                    if (canceled)
                    {
                        return;
                    }
                }
                else if (cursorState == CursorState.Up)
                {
                    OnClick();

                    if (canceled)
                    {
                        return;
                    }
                }
            }
        }

        if (cursorState == CursorState.Up)
        {
            if (!isHovering && isPressing)
            {
                OnNormal();

                if (canceled)
                {
                    return;
                }
            }

            active     = null;
            isPressing = false;
        }

        wasHovering = isHovering;
        wasDragging = isDragging;
    }