private void GestureListener_SwipeEvent(SwipeEnum swipe) { if (SwipeEvent != null) { SwipeEvent(swipe); } }
public void SetSwipeActive(SwipeEnum _swipeType) { part = null; swipeType = _swipeType; swipeAttack = heroParam.swapeSetting.First(x => x.swipeType == swipeType); unitParam.CoolDown = swipeAttack.coolDown; unitParam.SpeedAttack = swipeAttack.speedAttack; // unitParam.Damage = heroParam.Damage; if (swipeAttack.particleAttack != null) { part = swipeAttack.particleAttack; } IsStun = swipeAttack.isStun; }
private void SwipListener_SwipeEvent(SwipeEnum swipe) { try { if (swipe == SwipeEnum.Top) { PlayNext(); } else if (swipe == SwipeEnum.Bottom) { PlayPrevious(); } else if (swipe == SwipeEnum.SingleTab) { PlayPause(); } } catch (System.Exception ex) { } }
private void InteractionSourceUpdated(InteractionSourceUpdatedEventArgs obj) { if (obj.state.source.handedness == handedness) { if (obj.state.touchpadPressed) { // Check which side we clicked if (obj.state.touchpadPosition.x < 0) { currentAction = SwipeEnum.Left; } else { currentAction = SwipeEnum.Right; } // Ping the touchpad material so it gets bright touchpadTouchTime = Time.unscaledTime; } if (activeBrush != null) { // If the pressed amount is greater than our threshold, draw if (obj.state.selectPressedAmount >= selectPressedDrawThreshold) { activeBrush.Draw = true; activeBrush.Width = ProcessSelectPressedAmount(obj.state.selectPressedAmount); } else { // Otherwise, stop drawing activeBrush.Draw = false; selectPressedSmooth = 0f; } } } }
private void Update() { if (menuOpen) { if (Time.unscaledTime - menuOpenTime > menuTimeout) { menuOpen = false; } } if (controller != null) { for (int i = 0; i < brushCollection.Objects.Count; i++) { Brush brush = brushCollection.Objects[i].GetComponent <Brush>(); brush.StrokeColor = colorPicker.SelectedColor; if (brush == activeBrush) { brush.DisplayMode = Brush.DisplayModeEnum.InHand; } else { brush.DisplayMode = menuOpen ? Brush.DisplayModeEnum.InMenu : Brush.DisplayModeEnum.Hidden; } } // Update our touchpad material Color glowColor = touchpadColor.Evaluate((Time.unscaledTime - touchpadTouchTime) / touchpadGlowLossTime); touchpadMaterial.SetColor("_EmissionColor", glowColor); touchpadMaterial.SetColor("_Color", glowColor); if (!switchingBrush) { if (currentAction == SwipeEnum.None) { return; } if (!menuOpen) { menuOpenTime = Time.unscaledTime; menuOpen = true; } // Stop the active brush if we have one if (activeBrush != null) { activeBrush.Draw = false; activeBrush = null; } // Get the current offset and the target offset from our collection startOffset = brushCollection.GetOffsetFromObjectIndex(displayBrushindex); targetOffset = startOffset; switch (currentAction) { case SwipeEnum.Right: displayBrushindex = brushCollection.GetPrevObjectIndex(displayBrushindex); activeBrushindex = brushCollection.GetNextObjectIndex(activeBrushindex); targetOffset -= brushCollection.DistributionOffsetPerObject; break; case SwipeEnum.Left: default: displayBrushindex = brushCollection.GetNextObjectIndex(displayBrushindex); activeBrushindex = brushCollection.GetPrevObjectIndex(activeBrushindex); targetOffset += brushCollection.DistributionOffsetPerObject; break; } // Get the current brush from the object list Transform brushTransform = brushCollection.Objects[activeBrushindex]; activeBrush = brushTransform.GetComponent <Brush>(); // Lerp from current to target offset startTime = Time.unscaledTime; resetInput = false; switchingBrush = true; } else { if (Time.unscaledTime < startTime + swipeDuration) { float normalizedTime = (Time.unscaledTime - startTime) / swipeDuration; if (!resetInput && normalizedTime > 0.5f) { // If we're past the halfway point, set our swipe action to none // If the user swipes again before we're done switching, we'll move to the next item resetInput = true; currentAction = SwipeEnum.None; } brushCollection.DistributionOffset = Mathf.Lerp(startOffset, targetOffset, swipeCurve.Evaluate(normalizedTime)); menuOpenTime = Time.unscaledTime; } else { switchingBrush = false; brushCollection.DistributionOffset = targetOffset; } } } }
protected override void OnEnable() { base.OnEnable(); displayBrushindex = -1; currentAction = SwipeEnum.Left; }