fixes, portal sound changed, faders
This commit is contained in:
@@ -26,9 +26,6 @@ public class MenuTeleportButton : MonoBehaviour
|
||||
private EventInstance TeleportingSound;
|
||||
FMOD.Studio.Bus SpecialBus; //FMOD bus variable
|
||||
|
||||
private static MenuTeleportButton lastSelectedButton = null;
|
||||
private static bool initialized = false;
|
||||
|
||||
// External state: map must be held/visible
|
||||
public static bool MapIsOpen = false;
|
||||
private Menu menu;
|
||||
@@ -70,20 +67,7 @@ public class MenuTeleportButton : MonoBehaviour
|
||||
if (button != null && HoverSprite != null)
|
||||
{
|
||||
button.targetGraphic.GetComponent<Image>().sprite = HoverSprite;
|
||||
|
||||
// --- Only play hover sound if selection actually changed ---
|
||||
//if (initialized && lastSelectedButton != this)
|
||||
//{
|
||||
// if (!Menu.IsMapOpen) return;
|
||||
// if (!menu.MapTab.activeSelf) return; // ensures only map page buttons make sound
|
||||
// AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
|
||||
//}
|
||||
if (!Menu.IsMapOpen) return;
|
||||
if (!menu.MapTab.activeSelf) return; // ensures only map page buttons make sound
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
|
||||
|
||||
//lastSelectedButton = this;
|
||||
//initialized = true;
|
||||
//AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +83,29 @@ public class MenuTeleportButton : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Player-driven hover (joystick or controller)
|
||||
public void OnSelect(BaseEventData eventData)
|
||||
{
|
||||
if (HoverSprite != null)
|
||||
{
|
||||
button.targetGraphic.GetComponent<Image>().sprite = HoverSprite;
|
||||
}
|
||||
// Play FMOD hover sound
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
|
||||
}
|
||||
|
||||
public void OnDeselect(BaseEventData eventData)
|
||||
{
|
||||
if (NormalSprite != null)
|
||||
{
|
||||
button.targetGraphic.GetComponent<Image>().sprite = NormalSprite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void TeleportPlayer()
|
||||
{
|
||||
TutorialAudioListener.SuppressNextTeleportSound = true;
|
||||
if (target == null || Player == null || teleportationProvider == null)
|
||||
{
|
||||
Debug.LogWarning("Teleportation failed: Target, Player, or TeleportationProvider is missing.");
|
||||
@@ -127,6 +132,7 @@ public class MenuTeleportButton : MonoBehaviour
|
||||
button.interactable = false;
|
||||
button.interactable = true;
|
||||
|
||||
//muting teleportation when not needed
|
||||
StartCoroutine(MuteBusForSeconds(2.0f));
|
||||
|
||||
TeleportingSound.start(); //playing 2d oneshot
|
||||
|
||||
Reference in New Issue
Block a user