ActionTest.cs 1.06 KB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
using UnityEngine.SceneManagement;

public class ActionTest : MonoBehaviour
{

    public SteamVR_Input_Sources handType;          // 모두 사용, 왼손, 오른손
    public SteamVR_Action_Boolean teleportAction;   // 텔레포트 액션
    public SteamVR_Action_Boolean grabAction;       // 그랩 액션
    void Start()
    {
        
    }
    void Update()
    {
        if (GetTeleportDown())
        {
            Debug.Log("Teleport" + handType);
            if (handType.ToString() == "LeftHand" )
            {
               
             
                SceneManager.LoadScene("rpgpp_lt_scene_1.0");

            }
        }
        if (GetGrab())
        {
            Debug.Log("Grab" + handType);
        }
    }

    // 텔레포트가 활성화되면 true 반환
    public bool GetTeleportDown()
    {
        return teleportAction.GetStateDown(handType);
    }

    // 잡기 액션이 활성화되어 있으면 true 반환
    public bool GetGrab()
    {
        return grabAction.GetState(handType);
    }
}