/// <inheritdoc /> protected override void touchesMoved(IList <TouchPoint> touches) { base.touchesMoved(touches); for (var i = 0; i < touches.Count; i++) { var touch = touches[i]; var data = getPointerData(touch); if (TouchUtils.IsTouchOnTarget(touch, cachedTransform)) { if (!data.OnTarget) { data.OnTarget = true; ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerEnterHandler); } } else { if (data.OnTarget) { data.OnTarget = false; ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerExitHandler); } } setPointerData(touch, data); } Debug.Log("touches moved"); }
public override void Apply(TouchEvent touchEvent) { if (touchEvent.GetCurrentState() == TouchPhase.Ended && IsTap(touchEvent)) { Vector3 target; if (TouchUtils.TouchPositionToWorldCoords(touchEvent.GetStartPosition(), out target, hero.transform.position.y)) { hero.MoveToTarget(target); } } }
private void StartSwipe(TouchEvent touchEvent) { Vector3 lookPosition; if (TouchUtils.TouchPositionToWorldCoords(touchEvent.GetEndPosition(), out lookPosition, 0.5f)) { swipeStarted = true; hero.CancelMoveToTarget(); hero.LookAt(lookPosition, attackTime); hero.StartSwipeAttack(); } }
IEnumerator WaitForInput() { while (true) { if (TouchUtils.GetTapCount() == 1 || Input.GetKeyDown(KeyCode.C)) { SceneSettings.Instance.LockInput = true; Time.timeScale = 1f; tutorialCanvas.SetActive(false); break; } yield return(null); } }
private IEnumerator DrawSwipeAttack(TouchEvent touchEvent, float swipeTime = 0.2f) { int vertexCount = 0; List <Vector2> swipe = smoothSwipeInput(simplifySwipeInput(touchEvent)); foreach (Vector2 frame in swipe) { Vector3 currentTouchWorld; TouchUtils.TouchPositionToWorldCoords(frame, out currentTouchWorld, 0.5f); lineAttack.numPositions = vertexCount + 1; lineAttack.SetPosition(vertexCount++, currentTouchWorld); yield return(new WaitForSeconds(swipeTime / swipe.Count)); } swipeStarted = false; }
IEnumerator WaitForInput() { while (true) { var touchedObj = TouchUtils.GetTouchedObject(); if (touchedObj != null && touchedObj.tag == "Wizard") { SceneSettings.Instance.LockInput = true; Time.timeScale = 1f; tutorialCanvas.SetActive(false); break; } yield return(null); } }
private void GetInput() { if (SceneSettings.Instance.LockInput) { return; } int swipe = TouchUtils.GetSwipe(); var touchedObj = TouchUtils.GetTouchedObject(); if (touchedObj != null && touchedObj.tag == "Wizard" && (CurrentState & (FLAG_STATE_FADE | FLAG_STATE_FADE_SLASH | FLAG_STATE_DIE)) == 0) { if (!touchedObj.GetComponent <WizardController>().IsDead) { fadeSlashCommand.SetTarget(touchedObj.transform); InputQueue.Enqueue(inputFadeSlash); return; } } if ((Input.GetKeyDown(KeyCode.X) || swipe == TouchUtils.SWIPE_UP) && InputQueue.Count <= MAX_INPUT_QUEUE) { InputQueue.Enqueue(inputJump); } if ((TouchUtils.GetTapCount() == 1 || Input.GetKeyDown(KeyCode.C)) && InputQueue.Count <= MAX_INPUT_QUEUE && (CurrentState & (FLAG_STATE_FADE | FLAG_STATE_FADE_SLASH)) == 0) { InputQueue.Enqueue(inputSlash); } if ((Input.GetKeyDown(KeyCode.DownArrow) || swipe == TouchUtils.SWIPE_DOWN) && InputQueue.Count <= MAX_INPUT_QUEUE) { InputQueue.Enqueue(inputSlide); } if ((Input.GetKeyDown(KeyCode.RightArrow) || swipe == TouchUtils.SWIPE_RIGHT) && InputQueue.Count <= MAX_INPUT_QUEUE) { InputQueue.Enqueue(inputThrow); } }
public void Evaluate(int spreadMax) { spreadMax = CalculateMax(); TouchUtils.SetIsNew(FBlobIn, FPBlobs); if (IdIn.IsChanged || CheckForReinit()) { NeedsReinit(); } for (var i = 0; i < spreadMax; i++) { if (ReinitTransforms) { Reinit(i); } if (ResetIn[i]) { Reset(i); } TransformStates[i].Update(FBlobIn); Debug.WriteLine(TransformStates[i].Phase); if (TransformStates[i].Phase == TransformPhase.Transforming) { ProcessTransformation(i); } TransformStates[i].UpdatePValues(); } ReinitTransforms = false; FPBlobs.SliceCount = FBlobIn.SliceCount; FPBlobs.AssignFrom(FBlobIn); OutputData(spreadMax); }
/// <inheritdoc /> protected override void touchMoved(TouchPoint touch) { base.touchMoved(touch); var data = getPointerData(touch); if (TouchUtils.IsTouchOnTarget(touch, cachedTransform)) { if (!data.OnTarget) { data.OnTarget = true; ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerEnterHandler); } } else { if (data.OnTarget) { data.OnTarget = false; ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerExitHandler); } } setPointerData(touch, data); }