public static void CancelClick() { if (active != null) { active.canceled = true; active.isPressing = false; active = null; } }
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); }
private void OnTouchEnter(KinectButton button, JointId bone) { _particles.Play(); }
private void Awake() { _button = gameObject.GetComponent <KinectButton>(); _button.OnTouchEnter += OnTouchEnter; }
private static bool IsTouching(BoneState bone, KinectButton button) { const float threshold = 0.4f; return(math.distance(bone.position, button.transform.position) < threshold); }
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; }