1
0
forked from cgvr/DeltaVR

some sound bug fixes

This commit is contained in:
Timur Nizamov
2025-11-16 16:01:23 +02:00
parent e12c5f2f98
commit ef3b4c363e
40 changed files with 476 additions and 322 deletions

View File

@@ -9,7 +9,11 @@ public class FloorButtonVisualizer : MonoBehaviour
public Sprite ActiveSprite;
public bool ActiveState;
private Image buttonImage;
// Start is called before the first frame update
// --- Static tracking for selection change ---
private static FloorButtonVisualizer lastActiveButton = null;
private static bool initialized = false;
void Start()
{
buttonImage = gameObject.GetComponent<Image>();
@@ -19,12 +23,20 @@ public class FloorButtonVisualizer : MonoBehaviour
{
this.ActiveState = true;
buttonImage.sprite = ActiveSprite;
//Debug.Log("Floorbutton of " + gameObject.name + " activated");
// --- Only play hover if selection actually changed ---
if (initialized && lastActiveButton != this)
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
}
lastActiveButton = this;
initialized = true;
}
public void Deactivate()
{
this.ActiveState = false;
buttonImage.sprite = InactiveSprite;
//Debug.Log("Floorbutton of " + gameObject.name + " deactivated");
}
}