working build confirmed before tipilan, a few changes to ui and bow, order of audiomanager and fmodevents changed

This commit is contained in:
Timur Nizamov
2025-10-22 21:10:56 +03:00
parent 5623167eb9
commit f2475e6b06
33 changed files with 534 additions and 86 deletions

View File

@@ -7,6 +7,7 @@ using UnityEngine.Rendering;
using UnityEngine.UI;
using UnityEngine.XR.Interaction.Toolkit;
using FMOD.Studio;
using FMODUnity;
public class MenuTeleportButton : MonoBehaviour
{
@@ -22,10 +23,12 @@ public class MenuTeleportButton : MonoBehaviour
private TeleportLocation target; // Target teleport position
private EventInstance TeleportingSound;
FMOD.Studio.Bus SpecialBus; //FMOD bus variable
private void Awake()
{
TeleportingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Teleport); //initialise the instance
SpecialBus = FMODUnity.RuntimeManager.GetBus("bus:/LogicalMute");
}
@@ -102,6 +105,21 @@ public class MenuTeleportButton : MonoBehaviour
button.interactable = false;
button.interactable = true;
StartCoroutine(MuteBusForSeconds(1.5f));
TeleportingSound.start(); //playing 2d oneshot
}
private IEnumerator MuteBusForSeconds(float duration)
{
// Lower volume to 0 instantly
SpecialBus.setVolume(0f);
Debug.Log("[MenuTeleportButton] Muting LogicalMute bus...");
yield return new WaitForSeconds(duration);
// Restore volume
SpecialBus.setVolume(1f);
Debug.Log("[MenuTeleportButton] Unmuted LogicalMute bus.");
}
}