1118OPSSNew/Assets/Zion/Scripts/GameScene/Processes/Button/ButtonBase.cs

48 lines
1.1 KiB
C#

using Microsoft.MixedReality.Toolkit.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonBase : Device
{
[HideInInspector]
public PressableButtonHoloLens2 pressableButton;
/// <summary>
/// 联动物体
/// </summary>
public FunctionSync_PositionRoate linkageObject;
public FunctionSync_Audio sync_Audio;
public override void Start()
{
base.Start();
pressableButton = GetComponent<PressableButtonHoloLens2>();
pressableButton.ButtonPressed.AddListener(PressedEvent);
pressableButton.ButtonReleased.AddListener(ReleasedEvent);
}
/// <summary>
/// 按钮按下事件
/// </summary>
public virtual void PressedEvent()
{
sync_Audio.SetAudio(AudioControlEnum.Play);
}
/// <summary>
/// 按钮抬起释放
/// </summary>
public virtual void ReleasedEvent()
{
sync_Audio.SetAudio(AudioControlEnum.Play);
}
public virtual void Linkage()
{
}
// Update is called once per frame
void Update()
{
}
}