浏览代码

rework controls for test scene

/main
Filip Iliescu 7 年前
当前提交
a981054d
共有 1 个文件被更改,包括 2 次插入29 次删除
  1. 31
      Assets/TestScenes/MobileDeferredTest/Common/MobileTestSceneManager.cs

31
Assets/TestScenes/MobileDeferredTest/Common/MobileTestSceneManager.cs


static MobileTestSceneManager Instance;
private Vector2 startPosition;
private float startTime;
public UnityEngine.Experimental.Rendering.OnTileDeferredRenderPipeline.OnTileDeferredRenderPipeline pipeline;

}
}
// bool processRightSwipe()
// {
// if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Began) {
// Vector2 touchDeltaPosition = Input.GetTouch(0).position;
// if (touchDeltaPosition.x > Screen.width/2)
// return true;
// }
// return false;
// }
//
// bool processLeftSwipe()
// {
// if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Began) {
// Vector2 touchDeltaPosition = Input.GetTouch(0).position;
// if (touchDeltaPosition.x < Screen.width/2)
// return true;
// }
// return false;
// }
// float dist = Mathf.Sqrt(Mathf.Pow(delta.x, 2) + Mathf.Pow (delta.y, 2));
// float angle = Mathf.Atan (delta.y/delta.x) * (180.0f/Mathf.PI);
// float duration = Time.time - startTime;
// float speed = dist/duration;
if (startPosition.x < endPosition.x)
return 1;
else if (startPosition.x > endPosition.x)

void detectTouchBegan() {
if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Began) {
startPosition = Input.GetTouch(0).position;
startTime = Time.time;
}
}

}
#if (UNITY_EDITOR || UNITY_STANDALONE)
if (Input.GetKeyDown(KeyCode.S)) {
if (Input.GetKeyDown(KeyCode.Tab)) {
#else
if (detectSwipe() == 1) {
#endif

#if (UNITY_EDITOR || UNITY_STANDALONE)
if (Input.GetKeyDown(KeyCode.C)) {
if (Input.GetKeyDown(KeyCode.LeftShift)) {
#else
if (detectSwipe() == -1) {
#endif

正在加载...
取消
保存