Added extra sliders for audio (not audio logic not yet implemented) and got elevator outer buttons firing.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FloorButtonVisualizer : MonoBehaviour
|
||||
{
|
||||
public Sprite InactiveSprite;
|
||||
public Sprite ActiveSprite;
|
||||
public bool ActiveState;
|
||||
private Image buttonImage;
|
||||
|
||||
// --- Static tracking for selection change ---
|
||||
private static FloorButtonVisualizer lastActiveButton = null;
|
||||
private static bool initialized = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
buttonImage = gameObject.GetComponent<Image>();
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
this.ActiveState = true;
|
||||
buttonImage.sprite = ActiveSprite;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
|
||||
// --- 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user