working build confirmed before tipilan, a few changes to ui and bow, order of audiomanager and fmodevents changed
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
using FMOD.Studio;
|
||||
|
||||
[RequireComponent(typeof(TeleportationProvider))]
|
||||
public class TeleportationListen : MonoBehaviour
|
||||
{
|
||||
private TeleportationProvider teleportationProvider;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
teleportationProvider = GetComponent<TeleportationProvider>();
|
||||
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
// Subscribe to the event that fires when teleportation actually ends
|
||||
teleportationProvider.endLocomotion += OnTeleportEnd;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
teleportationProvider.endLocomotion -= OnTeleportEnd;
|
||||
}
|
||||
|
||||
private void OnTeleportEnd(LocomotionSystem locomotionSystem)
|
||||
{
|
||||
// ✅ Fires ONLY when teleportation successfully completes
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Steps, gameObject); //oneshot 3d event
|
||||
|
||||
Debug.Log("[TeleportationListen] Teleport sound played.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bdaa08e302fd9a4ab0f386f25762231
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user