VR模拟枪支打靶,消灭鬼怪,换弹以及上弦等等硬核枪支操作。 使用HTCVive设备,开启SteamVR进行游玩。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

3 years ago
//========= Copyright 2016-2018, HTC Corporation. All rights reserved. ===========
using System;
using UnityEngine;
using UnityEngine.UI;
namespace HTC.UnityPlugin.Vive.BindingInterface
{
public class BindingInterfaceRoleButtonItem : MonoBehaviour
{
[SerializeField]
private Toggle m_toggle;
[SerializeField]
private Text m_textRoleName;
private bool m_disableEventOnce;
public string roleName { get { return m_textRoleName.text; } set { m_textRoleName.text = value; } }
public int roleValue { get; set; }
public event Action<int> onValueChanged;
public void SetIsOn()
{
if (!m_toggle.isOn)
{
m_toggle.isOn = true;
m_toggle.group.NotifyToggleOn(m_toggle);
}
}
public void SetIsOnNoEvent()
{
if (!m_toggle.isOn)
{
m_disableEventOnce = true;
m_toggle.isOn = true;
}
}
public void OnValueChanged(bool isOn)
{
if (m_disableEventOnce)
{
m_disableEventOnce = false;
}
else if (isOn)
{
if (onValueChanged != null) { onValueChanged(roleValue); }
}
}
}
}