/// <summary> /// Pause the grab process if it is running. /// </summary> public void Pause() { if (_grabState == GrabState.Running) { _grabState = GrabState.Pause; } }
private void Run() { try { while (_grabState == GrabState.Running || _grabState == GrabState.Pause) { if (_grabState == GrabState.Pause) { _pauseEvent.WaitOne(); } else if (!Grab()) { //no more frames to grab, this is the end of the stream. We should stop. _grabState = GrabState.Stopping; } } } catch (Exception e) { throw; } finally { _grabState = GrabState.Stopped; } }
private void Run(Emgu.Util.ExceptionHandler eh = null) { try { while (_grabState == GrabState.Running || _grabState == GrabState.Pause) { if (_grabState == GrabState.Pause) { _pauseEvent.WaitOne(); } else if (IntPtr.Zero.Equals(_ptr) || !Grab()) { //capture has been released, or //no more frames to grab, this is the end of the stream. //We should stop. _grabState = GrabState.Stopping; } } } catch (Exception e) { if (eh != null && eh.HandleException(e)) { return; } Trace.WriteLine(e.StackTrace); throw new Exception("Capture error", e); } finally { _grabState = GrabState.Stopped; } }
public override void OnMouseButton(MouseButton button, Vector2 currentPosition, ButtonState state) { if (state == ButtonState.Pressed) { this.isDraggingSomething = true; } else { this.isDraggingSomething = false; } if (button == MouseButton.Left) { if (state == ButtonState.Pressed) { this.grabState = new GrabState(GetEdgeAtPoint(currentPosition), currentPosition, this.boundingRect.Rect, this.minSize, this.maxSize); } else { if (this.grabState.edge != RectEdge.None) { Resized?.Invoke(this, new ResizeEventArgs { PositionOffset = this.grabState.GetPositionDelta(this.currentMousePosition), NewSize = this.boundingRect.Size.ToVector2() + this.grabState.GetSizeDelta(this.currentMousePosition) }); } this.grabState = new GrabState(RectEdge.None, Vector2.Zero, Rectangle.Empty, Point.Zero, null); } } }
void Update() { switch (GrabState) { case GrabState.Down: { if (OVRInput.Get(OVRInput.Button.PrimaryHandTrigger, ovrHand)) { GrabState = GrabState.Holding; } break; } case GrabState.Holding: { if (!OVRInput.Get(OVRInput.Button.PrimaryHandTrigger, ovrHand)) { GrabState = GrabState.Released; } break; } case GrabState.Released: { if (OVRInput.GetDown(OVRInput.Button.PrimaryHandTrigger, ovrHand)) { GrabState = GrabState.Down; } break; } } // handle joystick movement joystickInput = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, ovrHand); }
/// <summary> /// Start the grab process in a separate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> //#if WITH_SERVICE_MODEL // /// <param name="eh">An exception handler. If provided, it will be used to handle exception in the capture thread.</param> //#endif public void Start( #if WITH_SERVICE_MODEL System.ServiceModel.Dispatcher.ExceptionHandler eh = null #endif ) { if (_grabState == GrabState.Pause) { _grabState = GrabState.Running; _pauseEvent.Set(); } else if (_grabState == GrabState.Stopped || _grabState == GrabState.Stopping) { _grabState = GrabState.Running; #if NETSTANDARD1_4 Task t = new Task(Run); t.Start(); #elif NETFX_CORE Windows.System.Threading.ThreadPool.RunAsync(delegate { Run(); }); #elif !WITH_SERVICE_MODEL ThreadPool.QueueUserWorkItem(delegate { Run(); }); #else ThreadPool.QueueUserWorkItem(delegate { Run(eh); }); #endif } }
private void Run() { try { while (_grabState == GrabState.Running || _grabState == GrabState.Pause) { if (_grabState == GrabState.Pause) { _pauseEvent.WaitOne(); } else if (IntPtr.Zero.Equals(_ptr) || !Grab()) { //capture has been released, or //no more frames to grab, this is the end of the stream. //We should stop. _grabState = GrabState.Stopping; } } } catch (Exception e) { throw new Exception("Capture error", e); } finally { _grabState = GrabState.Stopped; } }
public void PutDown() { levelScript.AddObjectToTile(this); grabState = GrabState.PutDown; currentHolder = null; OnPlaced(); }
private void OnThisGrabbableStateChange(GrabState grabState) { if (grabState == GrabState.Drop && rb != null) { rb.velocity *= speedModifier; rb.angularVelocity *= aungularSpeedModifier; } }
void OnTriggerStay(Collider other) { if ((currentMotionState == MotionState.moving)) { colliding = true; currentGrabState = GrabState.notGrabable; } }
/// <summary> /// Stop the grabbing thread /// </summary> public void Stop() { Log.Info($"Stopping, _grabState={_grabState}"); if (_grabState != GrabState.Stopped) { _grabState = GrabState.Stopping; } }
/// <summary> /// Start the grab process in a sperate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { if (_grabState != GrabState.Running) { _grabState = GrabState.Running; ThreadPool.QueueUserWorkItem(delegate { Run(); }); } }
private void dropStart() { _isGrabbed = false; _state = GrabState.SHRINKING; StopAllCoroutines(); StartCoroutine(Shrink()); onDropStart(); // Chama método aviso Drop para as subclasses poderem implementar }
public void Grab() { modeArrows[(int)mMode].gameObject.SetActive(false); mPlayerCtrl.attachSpriteAnim.Play("seek"); mGrabberSeekPos = mPlayerCtrl.attachPoint.position; mGrabState = GrabState.Seek; }
public void PickedUp(IHolder grabber) { levelScript.RemoveObjectFromTile(this); if (currentHolder != null) { currentHolder.DetachGrabbedObject(); } currentHolder = grabber; grabState = GrabState.PickedUp; }
/// <summary> /// Stop the grabbing thread /// </summary> public void Stop() { if (_grabState != GrabState.Stopped) { if (_grabState != GrabState.Stopping) { _grabState = GrabState.Stopping; } } }
private void OnStrigGrabStateChange(GrabState state) { if (state == GrabState.Drop) { dropStartTime = Time.time; dropStartPosition = middle.position; isLerping = true; middle.parent = transform; } }
/// <summary> /// Start the grab process in a sperate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { if (_grabState != GrabState.Running) { _grabState = GrabState.Running; #if NETFX_CORE ThreadPool.RunAsync(delegate { Run(); }); #else ThreadPool.QueueUserWorkItem(delegate { Run(); }); #endif } }
private void grabStart() { if (!_isGrabbed) { // Grab só iniciará uma vez _isGrabbed = true; _state = GrabState.GROWING; StopAllCoroutines(); StartCoroutine(Grow()); onGrabStart(); // Chama método aviso Grab para as subclasses poderem implementar } }
/// <summary> /// Called when the grenade grab state change /// </summary> /// <param name="grabState"></param> private void OnGrenadeGrabStateChange(GrabState grabState) { if (grabState == GrabState.Grab) { thisGrabbable.enabled = true; } else if (!pinWasUsed && grabState == GrabState.Drop && thisGrabbable.CurrentGrabState != GrabState.Grab) { thisGrabbable.enabled = false; } }
public void ResetState(ref PlayerState playerState) { timer = 0f; grabState = GrabState.Setup; enemyGrabbed = false; grabCollider.enabled = false; if (enemyCollider != null) { Physics2D.IgnoreCollision(enemyCollider, GetComponent <BoxCollider2D> (), false); } playerState = PlayerState.Default; }
// Use this for initialization void Start() { playerBody = GetComponent <Rigidbody2D> (); playerAnimator = GetComponent <Animator> (); grabCollider = GameObject.Find("Grab Collider Up").GetComponent <CircleCollider2D> (); grabCollider.enabled = false; grabState = GrabState.Setup; enemyGrabbed = false; playerAttackInfo = GetComponent <AttackInfoContainer> (); orientationSystem = GetComponent <OrientationSystem> (); moveInfo = GetComponent <AbilityBasicMovement> (); }
/// <summary> /// Stop the grabbing thread /// </summary> public void Stop() { if (_grabState == GrabState.Pause) { _grabState = GrabState.Stopping; _pauseEvent.Set(); } else if (_grabState == GrabState.Running) { _grabState = GrabState.Stopping; } }
public override void GrabBegin(int x, int y, bool strafe) { _grabState = strafe ? GrabState.Panning : GrabState.Orbiting; _grabPivot = _pivot; _grabEye = Eye; _grabTarget = Target; _grabBookmark = CurrentBookmark; _grabWinX = x; _grabWinY = y; _grabFar = RaycastFarPlane(x, y); Raycast(x, y, out _grabScene); }
private void OnGrabStateChange(GrabState newState) { if (newState == GrabState.Grab) { grabController = grabbable.GrabController; } if (newState == GrabState.Drop) { Debug.Log("drop"); GetComponent <Rigidbody>().isKinematic = false; GetComponent <Rigidbody>().AddForceAtPosition(grabController.Velocity * throwForce, grabController.transform.position); } }
/// <summary> /// Start the grab process in a sperate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { switch (_grabState) { case GrabState.Pause: _grabState = GrabState.Running; break; case GrabState.Stopped: case GrabState.Stopping: _grabState = GrabState.Running; ThreadPool.QueueUserWorkItem(state => Run()); break; } }
/// <summary> /// Start the grab process in a separate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> /// <param name="eh">An exception handler. If provided, it will be used to handle exception in the capture thread.</param> public void Start(Emgu.Util.ExceptionHandler eh = null) { if (_grabState == GrabState.Pause) { _grabState = GrabState.Running; _pauseEvent.Set(); } else if (_grabState == GrabState.Stopped || _grabState == GrabState.Stopping) { _grabState = GrabState.Running; _captureTask = new Task(delegate { Run(eh); }); _captureTask.Start(); } }
private void OnGrabRelease(XRController controller) { switch (grab) { case GrabState.One: grab = GrabState.None; if (controller.transform == grabbedObject.transform.parent) { var pos = grabbedObject.transform.position; grabbedObject.transform.parent = originalParent; grabbedObject.transform.position = pos; } if (before != null) { TransformObject after = new TransformObject(grabbedObject.transform); if (MultiGrab) { MultiLayerMoveOperation op = new MultiLayerMoveOperation(LayerManager.Instance.LayerHelper, before, after); OperationManager.Instance.PushOperation(op); foreach (Layer layer in LayerManager.Instance.layers) { layer.transform.parent = LayerManager.Instance.LayersHolder.transform; } } else { LayerMoveOperation op = new LayerMoveOperation(LayerManager.Instance.ActiveLayer, before, after); OperationManager.Instance.PushOperation(op); } before = null; } grabbedObject = null; originalParent = null; movable = null; resizable = null; break; case GrabState.Both: grab = GrabState.One; grabbedObject.transform.parent = controller == leftController ? rightController.transform : leftController.transform; ToolController.Instance.ToggleSelectedTool(true); break; default: break; } }
private void OnDominantGrabbableGrabStateChange(GrabState state) { if (state == GrabState.Drop) { if (secondaryGrabbable.CurrentGrabState == GrabState.Grab || secondaryGrabbable.CurrentGrabState == GrabState.Drop) { ReleaseSecondaryGrabbable(); } secondaryGrabbable.enabled = false; } else if (state == GrabState.Grab) { secondaryGrabbable.enabled = true; } }
/// <summary> /// Start the grab process in a separate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { if (_grabState == GrabState.Pause) { _grabState = GrabState.Running; _pauseEvent.Set(); } else if (_grabState == GrabState.Stopped || _grabState == GrabState.Stopping) { _grabState = GrabState.Running; #if NETFX_CORE ThreadPool.RunAsync(delegate { Run(); }); #else ThreadPool.QueueUserWorkItem(delegate { Run(); }); #endif } }
/// <summary> /// Start the grab process in a sperate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { switch (_grabState) { case GrabState.Pause: _grabState = GrabState.Running; break; case GrabState.Stopped: case GrabState.Stopping: _grabState = GrabState.Running; ThreadPool.QueueUserWorkItem(delegate { Run(); }); break; } }
/// <summary> /// Stop the grabbing thread /// </summary> public void Stop() { if (_grabState != GrabState.Stopped) { if (_grabState != GrabState.Stopping) _grabState = GrabState.Stopping; } }
/// <summary> /// Stop the grabbing thread /// </summary> public void Stop() { if (_grabState == GrabState.Pause) { _grabState = GrabState.Stopping; _pauseEvent.Set(); } else if (_grabState == GrabState.Running) _grabState = GrabState.Stopping; }
/// <summary> /// Pause the grab process if it is running. /// </summary> public void Pause() { if (_grabState == GrabState.Running) _grabState = GrabState.Pause; }
/// <summary> /// Start the grab process in a separate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { if (_grabState == GrabState.Pause) { _grabState = GrabState.Running; _pauseEvent.Set(); } else if (_grabState == GrabState.Stopped || _grabState == GrabState.Stopping) { _grabState = GrabState.Running; #if NETFX_CORE ThreadPool.RunAsync(delegate { Run(); }); #else ThreadPool.QueueUserWorkItem(delegate { Run(); }); #endif } }
private void Run() { try { while (_grabState == GrabState.Running || _grabState == GrabState.Pause) { if (_grabState == GrabState.Pause) { _pauseEvent.WaitOne(); } else if (!Grab()) { //no more frames to grab, this is the end of the stream. We should stop. _grabState = GrabState.Stopping; } } } catch (Exception e) { throw new Exception("Capture error", e); } finally { _grabState = GrabState.Stopped; } }
private void setStatus(GrabInstruction instruction, GrabStage stage, GrabState state) { Status.Instruction = instruction; Status.Stage = stage; Status.State = state; }
private void Run() { try { while (_grabState == GrabState.Running || _grabState == GrabState.Pause) { if (_grabState == GrabState.Pause) { _pauseEvent.WaitOne(); } else if (IntPtr.Zero.Equals(_ptr) || !Grab()) { //capture has been released, or //no more frames to grab, this is the end of the stream. //We should stop. _grabState = GrabState.Stopping; } } } catch (Exception e) { throw new Exception("Capture error", e); } finally { _grabState = GrabState.Stopped; } }
private void Run() { try { while (_grabState == GrabState.Running || _grabState == GrabState.Pause) { if (_grabState == GrabState.Pause) { Wait(100); } else if (!Grab()) { //no more frames to grab, this is the end of the stream. We should stop. _grabState = GrabState.Stopping; } } } catch (Exception e) { Log.Error(e); throw; } finally { _grabState = GrabState.Stopped; } }
/// <summary> /// Start the grab process in a sperate thread. Once started, use the ImageGrabbed event handler and RetrieveGrayFrame/RetrieveBgrFrame to obtain the images. /// </summary> public void Start() { if (_grabState != GrabState.Running) { _grabState = GrabState.Running; #if NETFX_CORE ThreadPool.RunAsync(delegate { Run(); }); #else ThreadPool.QueueUserWorkItem(delegate { Run(); }); #endif } }