private void Update() { m_TimeElapsed += Time.deltaTime; if (!m_GestureListener) { return; } if (m_GestureListener.isTPose()) { ForceFieldSwitch(); } else if (m_GestureListener.IsSwipeLeft()) { m_LeftPlaying = ParticleStartStop(m_ParticleWallLeft, m_LeftPlaying); } else if (m_GestureListener.IsSwipeRight()) { m_RightPlaying = ParticleStartStop(m_ParticleWallRight, m_RightPlaying); } else if (m_GestureListener.IsSwipeUp()) { m_TopPlaying = ParticleStartStop(m_ParticleWallTop, m_TopPlaying); } }
void Update() { // dont run Update() if there is no gesture listener if (!gestureListener) { return; } if (!isSpinning) { if (slideChangeWithKeys) { if (Input.GetKeyDown(KeyCode.PageDown)) { RotateLeft(); } else if (Input.GetKeyDown(KeyCode.PageUp)) { RotateRight(); } } if (slideChangeWithGestures && gestureListener) { if (gestureListener.IsSwipeLeft()) { RotateLeft(); } else if (gestureListener.IsSwipeRight()) { RotateRight(); } else if (gestureListener.IsSwipeUp()) { RotateUp(); } } } else { // spin the presentation if (stepsToGo > 0) { //if(Time.realtimeSinceStartup >= nextStepTime) { transform.Rotate(rotationStep, Space.World); stepsToGo--; //nextStepTime = Time.realtimeSinceStartup + Time.deltaTime; } } else { transform.rotation = Quaternion.Euler(rotationStep * 90f / spinSpeed) * initialRotation; isSpinning = false; } } }
// Update is called once per frame void Update() { // StartCoroutine(Timer()); if (HairstleOption) { var _pos = gameObject.transform.position; _pos.y = _pos.y + YposChanger; gameObject.transform.position = _pos; gameObject.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f); } i = Mathf.Clamp(i, 0, Hairstyles.Length - 1); if (GestureListener.IsSwipeLeft()) { Debug.Log("Swipe Left"); i++; SpriteRenderer.sprite = Hairstyles[i]; } if (GestureListener.IsSwipeRight()) { Debug.Log("Swipe Right"); i--; SpriteRenderer.sprite = Hairstyles[i]; } if (GestureListener.IsSwipeUp()) { Debug.Log("Swipe Up"); StartCoroutine(TakeScreenShot()); } if (Takescreenshot) { Texture2D SH = ScreenCapture.CaptureScreenshotAsTexture(); SH.Apply(); byte[] btScreenShot = SH.EncodeToJPG(); Destroy(SH); // save the screenshot as jpeg file string sDirName = SaveFolder + "/Screenshots"; if (!Directory.Exists(sDirName)) { Directory.CreateDirectory(sDirName); } string sFileName = sDirName + "/" + string.Format("{0:F0}", Time.realtimeSinceStartup * 10f) + ".jpg"; File.WriteAllBytes(sFileName, btScreenShot); Audio.Play(); Takescreenshot = false; FrameTexture.SetActive(false); } }
// Update is called once per frame void Update() { if (CubeGestureListener.IsSwipeRight()) { i++; SpriteRenderer.sprite = BackgroundImages[i]; } if (CubeGestureListener.IsSwipeLeft()) { i--; SpriteRenderer.sprite = BackgroundImages[i]; } if (CubeGestureListener.IsSwipeUp()) { } }
void Update() { swipeDown = false; swipeUp = false; zoomOut = false; zoomIn = false; // dont run Update() if there is no gesture listener if (!gestureListener) { return; } if (!isSpinning) { if (slideChangeWithKeys) { if (Input.GetKeyDown(KeyCode.PageDown) && timeRemaining > 0) { //RotateLeft(); IncrementScore(); timerBool = true; } else if (Input.GetKeyDown(KeyCode.PageUp)) { timerBool = false; timeRemaining = 60; jumpCounter = 0; jumpJackText.text = jumpCounter.ToString(); } } if (slideChangeWithGestures && gestureListener) { if (gestureListener.IsSwipeLeft()) { //RotateLeft(); NextScreen(); } else if (gestureListener.IsSwipeRight()) { //RotateRight(); PreviousScreen(); } if (gestureListener.IsSwipeDown()) { swipeDown = true; Debug.Log("down"); } if (gestureListener.IsSwipeUp()) { swipeUp = true; Debug.Log("up"); } if (gestureListener.IsZoomOut()) { zoomOut = true; Debug.Log("zoomout"); } if (gestureListener.IsZoomIn()) { zoomIn = true; Debug.Log("zoomin"); } //else if(gestureListener.IsSwipeUp()) //RotateUp(); } if (slideChangeWithGestures && gestureListener && timeRemaining > 0) { if (gestureListener.IsJump()) { IncrementScore(); timerBool = true; } } } else { // spin the presentation if (stepsToGo > 0) { //if(Time.realtimeSinceStartup >= nextStepTime) { if (screenCamera) { transform.RotateAround(transform.position, screenCamera.transform.TransformDirection(rotationAxis), rotationStep); } else { transform.Rotate(rotationAxis * rotationStep, Space.World); } stepsToGo--; //nextStepTime = Time.realtimeSinceStartup + Time.deltaTime; } } else { Quaternion cubeRotation = Quaternion.Euler(rotationAxis * rotationStep * 90f / spinSpeed) * initialRotation; transform.rotation = screenCamera ? screenCamera.transform.rotation * cubeRotation : cubeRotation; isSpinning = false; } } // if (_lerp) { // prevent overshooting with values greater than 1 float decelerate = Mathf.Min(decelerationRate * Time.deltaTime, 1f); _container.anchoredPosition = Vector2.Lerp(_container.anchoredPosition, _lerpTo, decelerate); // time to stop lerping? if (Vector2.SqrMagnitude(_container.anchoredPosition - _lerpTo) < 0.25f) { // snap to target and stop lerping _container.anchoredPosition = _lerpTo; _lerp = false; // clear also any scrollrect move that may interfere with our lerping _scrollRectComponent.velocity = Vector2.zero; } // switches selection icon exactly to correct page if (_showPageSelection) { SetPageSelection(GetNearestPage()); } } TimeDisplay(); Instructions(); if (timerBool == true) { timeRemaining -= Time.deltaTime; } }
//statric function, get input from keyboard or kinect static public KeyCode GetInput() { if (Input.GetKeyDown(KeyCode.S)) { return(KeyCode.S); } else if (Input.GetKeyDown(KeyCode.R)) { return(KeyCode.R); } else if (Input.GetKeyDown(KeyCode.J)) { Debug.Log("Input.GetKeyDown(KeyCode.J)"); return(KeyCode.J); } else if (Input.GetKeyDown(KeyCode.K)) { return(KeyCode.K); } else if (Input.GetKeyDown(KeyCode.L)) { return(KeyCode.L); } else if (Input.GetKeyDown(KeyCode.H)) { return(KeyCode.H); } else if (Input.GetKeyDown(KeyCode.Q)) { return(KeyCode.Q); } else if (slideChangeWithGestures && gestureListener) { if (gestureListener.IsSwipeUp()) { Debug.Log("Input.GetKeyDown(KeyCode.J)"); return(KeyCode.J); } if (gestureListener.IsSwipeLeft()) { Debug.Log("Input.GetKeyDown(KeyCode.J)"); return(KeyCode.K); } if (gestureListener.IsTpose()) { return(KeyCode.R); } if (gestureListener.IsSwipeRight()) { return(KeyCode.Q); } else { return(KeyCode.None); } } else { return(KeyCode.None); } }