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