void OnGesture(GestureState eventData) { if (GameManager.mode == GameMode.Game && GameManager.orthoToggle) { if (eventData == GestureState.SwipeLeft) { if (RayHit(GestureManager.orgLoc)) Move(Vector3.left); } else if (eventData == GestureState.SwipeRight) { if (RayHit(GestureManager.orgLoc)) Move(Vector3.right); } else if (eventData == GestureState.SwipeUp) { if (RayHit(GestureManager.orgLoc)) Move(Vector3.up); } else if (eventData == GestureState.SwipeDown) { if (RayHit(GestureManager.orgLoc)) Move(Vector3.down); } } }
public void Rest() { switch (TrainGestureState) { case GestureState.NoMovement: return; case GestureState.Close: Controller.StopBendFingers(); TrainGestureState = GestureState.NoMovement; break; case GestureState.Open: Controller.StopBendFingers(); TrainGestureState = GestureState.NoMovement; break; case GestureState.Supination: StartCoroutine(Supination(false)); break; case GestureState.Pronation: StartCoroutine(Pronation(false)); break; case GestureState.Flexion: StartCoroutine(Flexion(false)); break; case GestureState.Extension: StartCoroutine(Extension(false)); break; } }
public IEnumerator ResetHand() { for (var i = 0; i < Mathf.Abs(FelxionCount); i++) { yield return(new WaitForSeconds(0.01f)); Controller.RotateWrist(FelxionCount >= 0 ? 0.1f : -0.1f); } for (var i = 0; i < Mathf.Abs(SupnationCount); i++) { yield return(new WaitForSeconds(0.01f)); Controller.RotateForearm(SupnationCount >= 0 ? 0.1f : -0.1f); } for (var i = 0; i < Mathf.Abs(CloseCount); i++) { yield return(new WaitForSeconds(0.01f)); if (CloseCount >= 0) { Controller.StopBendFingersAmount(); } else { Controller.StartBendFingersAmount(); } } Controller.StartBendFingers(); Controller.StopBendFingers(); TrainGestureState = GestureState.NoMovement; TestGestureState = GestureState.NoMovement; SupnationCount = 0; FelxionCount = 0; CloseCount = 0; }
//return true if not matched, else return false private bool MatchingAnalysis(GestureState gesture) { if (gesture.ToMatchFrameIndex + 1 == gesture.ToMatch.Count) { var result = GestureMatchingEngine.LastFrameAnalyze(gesture); if (result == LastFrameResult.Matched) { gesture.Matched = true; return(false); } else if (result == LastFrameResult.Failed) { return(true); } else { return(false); } } else { if (GestureMatchingEngine.FrameAnalyze(gesture)) { return(false); } else { return(true); } } }
private void SetupTransitions() { current = GestureState.NO_TOUCH; transitions = new List <Transition>() { new Transition(GestureState.NO_TOUCH, GestureEvent.DOWN, GestureState.TOUCH_DOWN, HandleTouchDown), new Transition(GestureState.NO_TOUCH, GestureEvent.PINCH, GestureState.TOUCH_PINCH, HandlePinchStart), new Transition(GestureState.TOUCH_PINCH, GestureEvent.PINCH, GestureState.TOUCH_PINCH, HandlePinch), new Transition(GestureState.TOUCH_DOWN, GestureEvent.HOLD, GestureState.TOUCH_HOLD, HandleTouchHoldStart), new Transition(GestureState.TOUCH_DOWN, GestureEvent.PINCH, GestureState.TOUCH_PINCH, HandlePinchStart), new Transition(GestureState.TOUCH_DOWN, GestureEvent.DRAG, GestureState.TOUCH_DRAG, HandleDragStart), new Transition(GestureState.TOUCH_HOLD, GestureEvent.HOLD, GestureState.TOUCH_HOLD, HandleTouchHold), new Transition(GestureState.TOUCH_HOLD, GestureEvent.DRAG, GestureState.TOUCH_DRAG, () => { HandleTouchHoldEnd(); HandleDragStart(); }), new Transition(GestureState.TOUCH_HOLD, GestureEvent.PINCH, GestureState.TOUCH_PINCH, () => { HandleTouchHoldEnd(); HandlePinchStart(); }), new Transition(GestureState.TOUCH_DRAG, GestureEvent.DRAG, GestureState.TOUCH_DRAG, HandleDrag), new Transition(GestureState.TOUCH_DOWN, GestureEvent.DOUBLE, GestureState.NO_TOUCH, HandleDoubleTouch), new Transition(GestureState.TOUCH_DOWN, GestureEvent.UP, GestureState.NO_TOUCH, HandleTouchUp), new Transition(GestureState.TOUCH_HOLD, GestureEvent.UP, GestureState.NO_TOUCH, HandleTouchHoldEnd), new Transition(GestureState.TOUCH_PINCH, GestureEvent.UP, GestureState.NO_TOUCH, HandlePinchEnd), new Transition(GestureState.TOUCH_DRAG, GestureEvent.UP, GestureState.NO_TOUCH, HandleDragEnd), new Transition(GestureState.TOUCH_PINCH, GestureEvent.DRAG, GestureState.TOUCH_DRAG, () => { HandlePinchEnd(); HandleDragStart(); }), new Transition(GestureState.TOUCH_DRAG, GestureEvent.PINCH, GestureState.TOUCH_PINCH, () => { HandleDragCancel(); HandlePinchStart(); }), new Transition(GestureState.TOUCH_DRAG, GestureEvent.DOUBLE, GestureState.NO_TOUCH, HandleDragEnd) }; }
void TouchGesture(GestureState eventData) { if (mode == GameMode.Game && eventData == GestureState.DoubleTap) { ToggleOrthoMode(); } }
void OnGesture(GestureState eventData) { if (GameManager.mode == GameMode.Game && !GameManager.orthoToggle) { if (eventData == GestureState.SwipeLeft) { startAngle = transform.rotation; targetAngle = Quaternion.AngleAxis(90f, Vector3.up) * transform.rotation; StartCoroutine(Swipe()); } else if (eventData == GestureState.SwipeRight) { startAngle = transform.rotation; targetAngle = Quaternion.AngleAxis(90f, -Vector3.up) * transform.rotation; StartCoroutine(Swipe()); } else if (eventData == GestureState.SwipeUp) { startAngle = transform.rotation; targetAngle = Quaternion.AngleAxis(90f, Vector3.right) * transform.rotation; StartCoroutine(Swipe()); } else if (eventData == GestureState.SwipeDown) { startAngle = transform.rotation; targetAngle = Quaternion.AngleAxis(90f, -Vector3.right) * transform.rotation; StartCoroutine(Swipe()); } } }
private void HandleGamepadAPressed() { // TODO: Should this handle Submit from Edit > ProjectSettings > Input ? if (Input.GetButtonDown(GamePadButtonA)) { inputManager.RaiseSourceDown(this, GamePadId, InteractionSourcePressInfo.Select); isAPressed = true; navigationCompleted = false; currentGestureState = GestureState.APressed; } if (isAPressed) { HandleNavigation(); if (!holdStarted && !raiseOnce && !navigationStarted) { // Raise hold started when user has held A down for certain interval. Invoke("HandleHoldStarted", HoldStartedInterval); } // Check if we get a subsequent release on A. HandleGamepadAReleased(); } }
void DragFingerToMoveCamera(object beginDraw, object p) { //drawingRectOnScreen = (bool)beginDraw; GestureState state = (GestureState)beginDraw; Vector2 hitPosition = (Vector2)p; switch (state) { case GestureState.Started: { OnMoveCameraStarted(hitPosition); break; } case GestureState.Updated: { OnMovingCamera(hitPosition); break; } case GestureState.Ended: { OnMoveCameraEnded(hitPosition); break; } } }
/* * Checks for position of tool relative to interacting object. */ protected void CheckProximityStatus() { switch (m_toolHandState) { case HandState.SEARCHING: CheckForObjectCollision(); break; case HandState.HOLDING: //Closest proximity triggers //-------------------------- GameObject activeInterior = HydraController.Instance.HandTarget(m_hand, ProximityType.INSTRUMENT_INTERIOR, m_mode); GameObject activeProximity = HydraController.Instance.HandTarget(m_hand, ProximityType.INSTRUMENT_PROXIMITY, m_mode); //Set proximity state based on last state and current position //-------------------------- if (activeProximity == m_heldObject) { if (activeInterior == m_heldObject) { //Inside interior if (m_gestureState == GestureState.PROXIMITY) { m_gestureState = GestureState.PROXIMITY_TO_INTERIOR; } else if (m_gestureState == GestureState.EXTERIOR) { m_gestureState = GestureState.EXTERIOR_TO_INTERIOR; } } else { //Inside proximity if (m_gestureState == GestureState.INTERIOR) { m_gestureState = GestureState.INTERIOR_TO_PROXIMITY; } else if (m_gestureState == GestureState.EXTERIOR) { m_gestureState = GestureState.EXTERIOR_TO_PROXIMITY; } } } else { //Outside exterior if (m_gestureState == GestureState.PROXIMITY) { m_gestureState = GestureState.PROXIMITY_TO_EXTERIOR; } else if (m_gestureState == GestureState.INTERIOR) { m_gestureState = GestureState.INTERIOR_TO_EXTERIOR; } } ProcessGestures(); break; } }
/* * Tool enter state */ public override void TransitionIn() { m_toolHandState = BaseTool.HandState.SEARCHING; m_gestureState = GestureState.EXTERIOR; m_lastGestureState = GestureState.EXTERIOR; m_gestureTimer = m_betweenGestureDelay; }
private static void OnGestureComplete(Point gestureOrigin, Point releasePoint) { _state = GestureState.None; _previousDelta = null; RaiseGestureEvent((handler) => handler.GestureCompleted, () => new Microsoft.Phone.Controls.GestureEventArgs(gestureOrigin, releasePoint), false); }
/// <summary> /// Constructs a new <see cref="ActivateGestureEvent"/>. /// </summary> /// <param name="id">The <see cref="GestureId"/> associated with the gesture.</param> /// <param name="state">The <see cref="GestureId"/> associated with the gesture.</param> /// <param name="rayOrigin">The <see cref="Vector3"/> ray origin associated with the gesture.</param> /// <param name="rayDirection">The <see cref="Vector3"/> ray direction associated with the gesture.</param> public ActivateGestureEvent(GestureId id, GestureState state, Vector3 rayOrigin, Vector3 rayDirection) { m_Id = id; m_State = state; m_RayOrigin = rayOrigin; m_RayDirection = rayDirection; }
public CustomGesture(CustomGestureType type, Leap.Frame frame) { _type = type; _handsForGesture = frame.Hands; _pointablesForGesture = frame.Pointables; _state = GestureState.NA; }
public void Start() { currentAction = GestureAction.Idle; if (Camera.main == null) { throw new Exception("no camera in scene, cannot gesture"); } state = new GestureState() { zoomState = new GestureZoomState(), dragState = new GestureDragState(), twistState = new GestureTwistState(), tapState = new GestureTapState(), }; if (MousePlatforms.Contains(Application.platform)) { platform = new GesturePlatformMouse(gestures.config.mouse, keys, state, Camera.main, eventSystem); state.platformName = "Mouse"; return; } platform = new GesturePlatformTouch(state, Camera.main, gestures.config.touch); state.platformName = "Touch"; }
public virtual void OnXboxInputUpdate(XboxControllerEventData eventData) { if (string.IsNullOrEmpty(GamePadName)) { GamePadName = eventData.GamePadName; } if (XboxControllerMapping.GetButton_Down(SelectButton, eventData)) { CurrentGestureState = GestureState.SelectButtonPressed; InputManager.Instance.RaiseSourceDown(eventData.InputSource, eventData.SourceId, InteractionSourcePressInfo.Select); HoldStartedRoutine = StartCoroutine(HandleHoldStarted(eventData)); } if (XboxControllerMapping.GetButton_Pressed(SelectButton, eventData)) { HandleNavigation(eventData); } if (XboxControllerMapping.GetButton_Up(SelectButton, eventData)) { HandleSelectButtonReleased(eventData); } // Consume this event eventData.Use(); }
protected virtual void HandleNavigation(XboxControllerEventData eventData) { float displacementAlongX = XboxControllerMapping.GetAxis(HorizontalNavigationAxis, eventData); float displacementAlongY = XboxControllerMapping.GetAxis(VerticalNavigationAxis, eventData); if (displacementAlongX == 0.0f && displacementAlongY == 0.0f && CurrentGestureState != GestureState.NavigationStarted) { return; } NormalizedOffset.x = displacementAlongX; NormalizedOffset.y = displacementAlongY; NormalizedOffset.z = 0f; if (CurrentGestureState != GestureState.NavigationStarted) { if (CurrentGestureState == GestureState.HoldStarted) { InputManager.Instance.RaiseHoldCanceled(eventData.InputSource, eventData.SourceId); } CurrentGestureState = GestureState.NavigationStarted; // Raise navigation started event. InputManager.Instance.RaiseNavigationStarted(eventData.InputSource, eventData.SourceId); } else { // Raise navigation updated event. InputManager.Instance.RaiseNavigationUpdated(eventData.InputSource, eventData.SourceId, NormalizedOffset); } }
protected virtual void HandleSelectButtonReleased(XboxControllerEventData eventData) { InputManager.Instance.RaiseSourceUp(eventData.InputSource, eventData.SourceId, InteractionSourcePressInfo.Select); if (HoldStartedRoutine != null) { StopCoroutine(HoldStartedRoutine); } switch (CurrentGestureState) { case GestureState.NavigationStarted: InputManager.Instance.RaiseNavigationCompleted(eventData.InputSource, eventData.SourceId, Vector3.zero); break; case GestureState.HoldStarted: InputManager.Instance.RaiseHoldCompleted(eventData.InputSource, eventData.SourceId); break; default: InputManager.Instance.RaiseInputClicked(eventData.InputSource, eventData.SourceId, InteractionSourcePressInfo.Select, 1); break; } CurrentGestureState = GestureState.SelectButtonUnpressed; }
void OnGesture(GestureState eventData) { if (GameManager.mode == GameMode.Game && GameManager.orthoToggle) { if (eventData == GestureState.SwipeLeft) { if (RayHit(GestureManager.orgLoc)) { Move(Vector3.left); } } else if (eventData == GestureState.SwipeRight) { if (RayHit(GestureManager.orgLoc)) { Move(Vector3.right); } } else if (eventData == GestureState.SwipeUp) { if (RayHit(GestureManager.orgLoc)) { Move(Vector3.up); } } else if (eventData == GestureState.SwipeDown) { if (RayHit(GestureManager.orgLoc)) { Move(Vector3.down); } } } }
/// <summary> /// Tries to change gesture state. /// </summary> /// <param name="value">New state.</param> /// <returns><c>true</c> if state was changed; otherwise, <c>false</c>.</returns> protected bool setState(GestureState value) { if (gestureManagerInstance == null) { return(false); } if (requireGestureToFail != null) { switch (value) { case GestureState.Recognized: case GestureState.Began: if (!requiredGestureFailed) { delayedStateChange = value; return(false); } break; case GestureState.Possible: case GestureState.Failed: case GestureState.Cancelled: delayedStateChange = GestureState.Possible; break; } } var newState = gestureManagerInstance.GestureChangeState(this, value); State = newState; return(value == newState); }
public TwoFingerTouch(int id, CGPoint coord1, CGPoint coord2, GestureState state) { Id = id; Coord1 = coord1; Coord2 = coord2; State = state; }
private IEnumerator ResetWhenTouchesEnd() { // Wait for lack of input bool bHasTouches = Input.touchCount > 0; bool bHasMouseInput = Input.GetMouseButton(0); while (bHasTouches || bHasMouseInput) { yield return(null); bHasTouches = Input.touchCount > 0; bHasMouseInput = !Input.GetMouseButton(0); } // Reset Gesture bool bHasBuffer = m_pxBuffer != null; if (bHasBuffer) { State = GestureState.GestureStateWaiting; } else { State = GestureState.GestureStatePossible; } }
public void Pinch(GestureState state, float scale, SKPoint origin) { switch (state) { case GestureState.Started: startPinchMatrix = Matrix; startPinchOrigin = origin; totalPinchScale = 1f; break; case GestureState.Running: totalPinchScale *= scale; var pinchTranslation = origin - startPinchOrigin; var canvasTranslation = SKMatrix.MakeTranslation(pinchTranslation.X, pinchTranslation.Y); var canvasScaling = SKMatrix.MakeScale(totalPinchScale, totalPinchScale, origin.X, origin.Y); var canvasCombined = SKMatrix.MakeIdentity(); SKMatrix.Concat(ref canvasCombined, ref canvasScaling, ref canvasTranslation); SKMatrix.Concat(ref Matrix, ref canvasCombined, ref startPinchMatrix); break; default: startPinchMatrix = SKMatrix.MakeIdentity(); startPinchOrigin = SKPoint.Empty; totalPinchScale = 1f; break; } }
internal void Reset() { activeTouches.Clear(); delayedStateChange = GestureState.Possible; requiredGestureFailed = false; reset(); }
public void OnTouch(GestureState state) { if (state.phase == GesturePhase.End) { target.SendMessage(methodName); } }
/// <summary> /// Constructs a new <see cref="MagicLeapKeyPoseGestureEvent"/>. /// </summary> /// <param name="id">The <see cref="GestureId"/> associated with the gesture.</param> /// <param name="state">The <see cref="GestureId"/> associated with the gesture.</param> /// <param name="keyPose">The <see cref="MagicLeapKeyPose"/> associated with the gesture.</param> /// <param name="hand">The <see cref="MagicLeapHand"/> associated with the gesture.</param> public MagicLeapKeyPoseGestureEvent(GestureId id, GestureState state, MagicLeapKeyPose keyPose, MagicLeapHand hand) { m_Id = id; m_State = state; m_KeyPose = keyPose; m_Hand = hand; }
private void HandleGamepadAPressed() { if (Input.GetButtonDown(GamePadButtonA)) { //Debug.Log("Gamepad: A pressed"); isAPressed = true; navigationCompleted = false; currentGestureState = GestureState.APressed; InputRouter.Instance.PressedSources.Add(InteractionSourceKind.Controller); } if (isAPressed) { HandleNavigation(); if (!holdStarted && !raiseOnce && !navigationStarted) { // Raise hold started when user has held A down for certain interval. Invoke("HandleHoldStarted", HoldStartedInterval); } // Check if we get a subsequent release on A. HandleGamepadAReleased(); } }
public void Reset() { IterationCount = 0; State = GestureState.None; Timestamp = 0; StartPosition = LPosition.None; CurrentPosition = LPosition.None; }
private void transition(GestureState newState) { if (newState != state) { //Console.Out.WriteLine("Transition {0} => {1}", state, newState); state = newState; } }
public void Reset() { gesturestate = GestureState.NONE; initialdistance = 0.0; predistance = 0.0; trackid = 0; scaleindex = 0; }
public void PinchInProgress_is_false_when_pinch_state_changed(GestureState state) { var recognizer = new PlatformPinchRecognizerStub(new object()); recognizer.OnPinchingBegan(0, 0); recognizer.OnPinchingStateChanged(state); recognizer.PinchInProgress.Should().BeFalse("since the pinch state changed"); }
protected override void AddGestureEventToCurrentList(GestureState state) { var deltaTrans = currPosition - lastPosition; CurrentGestureEvents.Add(new GestureEventDrag(state, ConfigDrag.RequiredNumberOfFingers, ElapsedSinceLast, ElapsedSinceBeginning, ConfigDrag.DragShape, NormalizeVector(startPosition), NormalizeVector(currPosition), NormalizeVector(deltaTrans))); lastPosition = currPosition; base.AddGestureEventToCurrentList(state); }
protected override void AddGestureEventToCurrentList(GestureState state) { var deltaRotation = currentRotation - lastRotation; var deltaScale = currentScale - lastScale; CurrentGestureEvents.Add(new GestureEventComposite(state, ElapsedSinceLast, ElapsedSinceBeginning, deltaRotation, currentRotation, deltaScale, currentScale, NormalizeVector(beginCenter), NormalizeVector(lastCenter), NormalizeVector(currentCenter))); lastRotation = currentRotation; lastScale = currentScale; lastCenter = currentCenter; base.AddGestureEventToCurrentList(state); }
/// <summary>Begins the recognition of the current gesture.</summary> void BeginRecognition() { if (SingleTouch()) { if (Input.touches[0].phase == TouchPhase.Began) { currentGesture = new Tap(Input.touches[0].position, Time.time); if (gestureState == GestureState.NEUTRAL) { NotifyGestureRecognitionStart(); } gestureState = GestureState.TAP; } } else if (MultiTouch()) { currentGesture = new Sprinch(Input.touches[0].position, Input.touches[1].position); gestureState = GestureState.SPRINCH; } }
internal GestureEventTranslation(GestureType type, GestureState state, int numberOfFingers, TimeSpan deltaTime, TimeSpan totalTime, GestureShape shape, Vector2 startPos, Vector2 currPos, Vector2 deltaTrans) { Type = type; State = state; NumberOfFinger = numberOfFingers; DeltaTime = deltaTime; TotalTime = totalTime; Shape = shape; StartPosition = startPos; CurrentPosition = currPos; DeltaTranslation = deltaTrans; TotalTranslation = currPos - startPos; AverageSpeed = TotalTranslation / (float)(TotalTime.TotalSeconds + 0.0001f); // avoid division by zero }
internal GestureEventComposite(GestureState state, TimeSpan deltaTime, TimeSpan totalTime, float deltaAngle, float totalAngle, float deltaScale, float totalScale, Vector2 firstCenter, Vector2 lastCenter, Vector2 currentCenter) { Type = GestureType.Composite; State = state; DeltaTime = deltaTime; TotalTime = totalTime; DeltaRotation = deltaAngle; TotalRotation = totalAngle; DeltaScale = deltaScale; TotalScale = totalScale; DeltaTranslation = currentCenter-lastCenter; TotalTranslation = currentCenter-firstCenter; CenterBeginningPosition = firstCenter; CenterCurrentPosition = currentCenter; }
public void UpdatePosition(long timeStamp) { if (State != GestureState.InProcess) { State = GestureState.InProcess; TimeStamp = timeStamp; } }
protected virtual void AddGestureEventToCurrentList(GestureState state) { ElapsedSinceLast = TimeSpan.Zero; if (state == GestureState.Ended) GestureBeganEventSent = false; }
/// <summary> /// Limpia los datos de este gesto /// para comenzar un reconocimiento nuevo /// </summary> public void Clear() { FirstPosition = Vector2.one * -1; LastPosition = FirstPosition; StartTime = -1; State = GestureState.Possible; }
public void UpdateState(GestureState state, long timeStamp) { State = state; TimeStamp = timeStamp; }
public void Correct() { if(m_coroutine != null) StopCoroutine(m_coroutine); m_gestureState = GestureState.START; m_playerMgr.RemoveBB(); m_HUDService.HUDControl.ShowHPBars(true); m_HUDService.ShowQuestTime(true); if(m_FXObj != null) Destroy(m_FXObj); ++gaugeCount; if(gaugeCount > m_fullgaugeCount) gaugeCount = m_fullgaugeCount; if(m_phase == BattlePhase.SPECIAL) { m_phase = BattlePhase.ATTACK; gaugeCount = 0; ResetGauge(); } else { m_HUDService.HUDControl.SetSpecialGaugeAmt((float)gaugeCount/m_fullgaugeCount); } }
} internal void Reset() {
IEnumerator CommenceAtkInterval() { // Testing for Emiko's Proposal // yield return new WaitForSeconds(m_interval); if (GestureGenerateMethod != null) { GestureGenerateMethod (); } m_HUDService.HUDControl.ShowTip(true); // Display Special Effect m_FXObj = Instantiate(Resources.Load ("Prefabs/FX/Special_Attack_Fx")) as GameObject; m_FXObj.transform.SetParent(m_itemParent.transform, false); m_FXObj.transform.localPosition = new Vector3(720, m_FXObj.transform.localPosition.y, -20); // Remove HUD m_HUDService.HUDControl.ShowTop(false); m_HUDService.HUDControl.ShowHPBars(false); m_HUDService.ShowQuestTime(false); m_cntDwnRnt = Utility.DelayInSeconds(m_gestureInv - m_specialCountDown, (res) => { GameObject obj = Instantiate(Resources.Load("Prefabs/Battle/CountDown")) as GameObject; obj.transform.SetParent(m_HUDService.HUDControl.transform, false); obj.transform.localScale = new Vector3(180, 180, 1); } ); StartCoroutine(m_cntDwnRnt); // Count Down till Gesture Failure yield return new WaitForSeconds(m_gestureInv); ClearGesture(); m_playerMgr.RemoveBB(); m_HUDService.HUDControl.ShowTop (true); m_HUDService.HUDControl.ShowHPBars(true); m_HUDService.ShowQuestTime(true); m_soundService.StopMusic(m_SPECIAL); m_soundService.PlayMusic(m_BGM, true); if(m_FXObj != null) Destroy(m_FXObj); m_gestureState = GestureState.END; gaugeCount = 0; ResetGauge(); m_phase = BattlePhase.ATTACK; // Move Camera to view Enemy Service.Get<MapService>().TweenPos(new Vector3(703f, -3.76f, 0.0f), new Vector3(-703f, -3.76f, 0.0f), UITweener.Method.EaseInOut, UITweener.Style.Once, null, ""); }
internal SwipeGesture (GestureState state, Vector2 point, Vector2 surfacePoint, SwipeDirection direction) : base(state, point, surfacePoint) { this.Direction = direction; }
public Gesture (GestureState state, Vector2 point, Vector2 surfacePoint) { this.State = state; this.Point = point; this.SurfacePoint = surfacePoint; }
void Update() { switch(m_phase) { case BattlePhase.START: { m_phase = BattlePhase.ATTACK; } break; case BattlePhase.ATTACK: { m_gestureHandler.DisableGesture = true; if(gaugeCount >= m_fullgaugeCount) { if(m_beginFinisher) { m_phase = BattlePhase.SPECIAL; m_beginFinisher = false; } } } break; case BattlePhase.SPECIAL: { if(m_gestureState == GestureState.START) { m_gestureHandler.DisableGesture = false; m_gestureState = GestureState.SHOWING; m_gestureStart = true; m_coroutine = CommenceAtkInterval(); GestureGenerateMethod = m_gestureGenerator.GenerateEasyGesture; StartCoroutine(m_coroutine); } } break; case BattlePhase.END: { if(m_win) { StartCoroutine(Utility.DelayInSeconds( 4.0f, (res) => { m_soundService.StopMusic(m_SPECIAL); m_boardCollider.SetActive(true); if(m_boardHandler != null) m_boardHandler.Init(m_win); } )); } else { m_win = true; // Reset win GameObject obj = Instantiate(Resources.Load("Prefabs/GeneralPopUp")) as GameObject; GeneralPopUp popuphandler = obj.GetComponent<GeneralPopUp>(); popuphandler.Init("Use 1 Gem to Revive with full HP.", "Yes", "No", Revive, Exit); m_HUDService.HUDControl.AttachMid(ref obj); } m_phase = BattlePhase.TOTAL; } break; } }
void Start() { m_enemyMgr = EnemyManager.Get(); m_playerMgr = PlayerManager.Get(); m_gestureHandler = InputManager.Get(); m_gestureStart = false; m_beginFinisher = false; m_gestureState = GestureState.START; m_phase = BattlePhase.START; gaugeCount = 0; m_win = true; Service.Init(); m_HUDService = Service.Get<HUDService>(); m_HUDService.StartScene(); // Create Battle HUD m_HUDService.CreateBattleHUD(); m_HUDService.ShowBottom(false); m_HUDService.HUDControl.SetSpecialEnable(false); // Create Sound Service m_soundService = Service.Get<SoundService>(); m_soundService.PreloadSFXResource(new string[13]{"attack01", "attack02", "attack03", "countdown", "enemyattack", "finalstrokeappear", "gaugefull", "magicnotecorrect", "playermoveattack", "sceneswish", "supermove", "win", "LadyKnight_Shine"}); m_BGM = Resources.Load("Music/" + m_bgmMusic) as AudioClip; m_SPECIAL = Resources.Load("Music/supermove_jingle" ) as AudioClip; m_soundService.PlayMusic(m_BGM, true); // Create Battle HUD if (nextBattleArea == 1) { m_bgTexture.mainTexture = Resources.Load ("Texture/BG_battle3") as Texture; } else if (nextBattleArea == 2) { m_bgTexture.mainTexture = Resources.Load ("Texture/BG_battle2") as Texture; } }
void OnFinishPressed() { if(m_coroutine != null) StopCoroutine(m_coroutine); m_gestureState = GestureState.START; m_soundService.StopMusic(m_BGM); m_soundService.PlayMusic(m_SPECIAL, true); m_HUDService.HUDControl.SetSpecialFxGlow(false); ResetGauge(); m_beginFinisher = true; m_HUDService.HUDControl.ShowActionButtons(false); m_HUDService.HUDControl.SetSpecialEnable(false); }
public void UpdatePosition(WavePosition position, long timeStamp) { if (CurrentPosition != position) { if (position == WavePosition.Left || position == WavePosition.Right) { if (State != GestureState.InProcess) { State = GestureState.InProcess; IterationCount = 0; StartPosition = position; } ++IterationCount; } CurrentPosition = position; TimeStamp = timeStamp; } }
public void Reset() { State = GestureState.None; TimeStamp = 0; StartX = 0; StartY = 0; }
/// <summary> /// Actualiza la informacion de este gesto, comprobando si es posible que sea valido /// </summary> /// <param name="position">Posicion a revisar</param> /// <param name="currentTime">Tiempo actual</param> /// <param name="ending">Indica si la posicion es el final del gesto o no</param> public void Update(Vector2 position, float currentTime, bool ending = false) { // Si se ha descartado ya el gesto, retornar if (State == GestureState.Failed) { return; } // Si se esta comenzando el reconocimiento if (StartTime == -1) { FirstPosition = position; LastPosition = FirstPosition; StartTime = currentTime; return; } // Reviso que el tiempo maximo no haya sido alcanzado // y en caso de estar terminando el reconocimiento, que la distancia minima haya sido cubierta if (currentTime - StartTime > MaxTime || (ending && (FirstPosition - position).sqrMagnitude < MinDistance * MinDistance)) { State = GestureState.Failed; return; } // Reviso las condiciones especificas del gesto State = CheckConditions(position); if (ending && State == GestureState.Possible) { State = GestureState.Recognized; } }
public void SpecialCorrect() { if(m_coroutine != null) StopCoroutine(m_coroutine); m_gestureState = GestureState.START; m_playerMgr.RemoveBB(); m_HUDService.HUDControl.ShowTop (true); m_HUDService.HUDControl.ShowHPBars(true); m_HUDService.ShowQuestTime(true); if(m_FXObj != null) Destroy(m_FXObj); m_phase = BattlePhase.ATTACK; gaugeCount = 0; ResetGauge(); }
/// <summary> /// Called to reset gesture state after it fails or recognizes. /// </summary> protected virtual void reset() { } /// <summary> /// Tries to change gesture state. /// </summary> /// <param name="value">New state.</param> /// <returns><c>true</c> if state was changed; otherwise, <c>false</c>.</returns> protected bool setState(GestureState value)
internal void INTERNAL_SetState(GestureState value) { setState(value); }
public void UpdatePosition(float x, float y, long timeStamp) { if (StartX != x || StartY != y) { if (State != GestureState.InProcess) { State = GestureState.InProcess; StartX = x; StartY = y; TimeStamp = timeStamp; } } }
internal void INTERNAL_Reset() { activeTouches.Clear(); numTouches = 0; delayedStateChange = GestureState.Possible; touchesNumState = TouchesNumState.TooFew; requiredGestureFailed = false; reset(); }
internal PanGesture (GestureState state, Vector2 point, Vector2 surfacePoint, Vector2 translation) : base(state, point, surfacePoint) { this.Translation = translation; }
/// <summary> /// Tries to change gesture state. /// </summary> /// <param name="value"> New state. </param> /// <returns> <c>true</c> if state was changed; otherwise, <c>false</c>. </returns> protected bool setState(GestureState value) { if (gestureManagerInstance == null) return false; if (!enabled && value != GestureState.Failed) return false; if (requireGestureToFail != null) { switch (value) { case GestureState.Recognized: case GestureState.Began: if (!requiredGestureFailed) { delayedStateChange = value; return false; } break; case GestureState.Possible: case GestureState.Failed: case GestureState.Cancelled: delayedStateChange = GestureState.Possible; break; } } var newState = gestureManagerInstance.INTERNAL_GestureChangeState(this, value); State = newState; return value == newState; }