【pico】_连续扣动两次扳机,退出应用

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pvr_UnitySDKAPI;

public class gobackSceneManager : MonoBehaviour
{
private bool IsTiming;
private float CountDown;


void Update()
{

}

private void ExitDection()
{
if (Controller.UPvr_GetControllerState(0) == ControllerState.Connected)
{
  if (Controller.UPvr_GetKeyDown(0, Pvr_KeyCode.TRIGGER))
  {
    if (CountDown == 0)
    {
      CountDown = Time.time;
      IsTiming = true;
    }
    else
    {
      Application.Quit();
    }
  }
  if (IsTiming)
  {
    if (Time.time - CountDown > 2.0)
    {
      CountDown = 0;
      IsTiming = false;
    }
  }
}
}
}

posted @ 2021-11-16 21:15  虚拟现实少年  阅读(443)  评论(0编辑  收藏  举报