46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Fusion.Addons.ConnectionManagerAddon;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.XR;
|
|
|
|
namespace BNG
|
|
{
|
|
public class ToggleActiveOnInputAction : MonoBehaviour
|
|
{
|
|
|
|
public InputActionReference InputAction = default;
|
|
public GameObject ToggleObject = default;
|
|
private UnityEngine.XR.InputDevice leftController;
|
|
|
|
private void Start()
|
|
{
|
|
// دریافت کنترلر دست چپ در هنگام شروع
|
|
|
|
leftController = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
|
|
}
|
|
|
|
public bool show;
|
|
public void Toggle()
|
|
{
|
|
if (show)
|
|
show = false;
|
|
else
|
|
show = true;
|
|
}
|
|
public void Update()
|
|
{
|
|
|
|
ToggleObject.SetActive(show);
|
|
if (Input.GetKeyDown(KeyCode.LeftShift))
|
|
CreateTablet();
|
|
}
|
|
public Transform tabletPosition;
|
|
public void CreateTablet()
|
|
{
|
|
ConnectionManager.instance.CreateTablet(tabletPosition);
|
|
}
|
|
}
|
|
}
|