Add music throughout. Start work on the prediction side pannels
This commit is contained in:
@@ -5,7 +5,14 @@ using Utils.Utils;
|
||||
|
||||
public class AudioManager : Singleton<AudioManager>
|
||||
{
|
||||
//aaaaa theres nicer syntax for this i think
|
||||
protected override bool dontDestroyOnLoad()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private AudioSource audioSource;
|
||||
private AudioSource musicAudioSource;
|
||||
|
||||
[SerializeField]
|
||||
private List<GameEntry<AudioClip>> clips = new List<GameEntry<AudioClip>>();
|
||||
@@ -19,6 +26,13 @@ public class AudioManager : Singleton<AudioManager>
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
audioSource.pitch = 1;
|
||||
|
||||
musicAudioSource = transform.Find("Music").GetComponent<AudioSource>();
|
||||
musicAudioSource.loop = true;
|
||||
if (!musicAudioSource.isPlaying)
|
||||
{
|
||||
musicAudioSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(string type)
|
||||
@@ -35,4 +49,20 @@ public class AudioManager : Singleton<AudioManager>
|
||||
audioSource.PlayOneShot(speech[index], 1.5f);
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
transform.position = Camera.main.transform.position;
|
||||
}
|
||||
|
||||
public void PlayMusic()
|
||||
{
|
||||
if (musicAudioSource.isPlaying) return;
|
||||
musicAudioSource.Play();
|
||||
}
|
||||
|
||||
public void StopMusic()
|
||||
{
|
||||
musicAudioSource.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,12 +261,14 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
if (guard != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("WordAdd");
|
||||
currentGuardManager = guard;
|
||||
guard.isfocussed = 2;
|
||||
if (talkButton != null) talkButton.gameObject.SetActive(true);
|
||||
}
|
||||
else if (door != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("WordAdd");
|
||||
currentDoorManager = door;
|
||||
door.isfocussed = 2;
|
||||
if (doorButton != null) doorButton.gameObject.SetActive(true);
|
||||
@@ -277,6 +279,7 @@ public class CameraController : MonoBehaviour
|
||||
// TRIPWIRE 4: ADD THIS LINE HERE
|
||||
Debug.Log("💨 Raycast hit nothing on the Interactable layer. Returning to main camera.");
|
||||
ReturnToMainCamera();
|
||||
AudioManager.Instance.PlaySound("WordRemove");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,8 +287,9 @@ public class CameraController : MonoBehaviour
|
||||
{
|
||||
if (currentGuardManager != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
DialogManager.Instance.StartDialog(currentGuardManager);
|
||||
talkButton.gameObject.SetActive(false);
|
||||
//talkButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +299,7 @@ public class CameraController : MonoBehaviour
|
||||
{
|
||||
// Add your door sequence logic here!
|
||||
Debug.Log("Door sequence started!");
|
||||
doorButton.gameObject.SetActive(false);
|
||||
//doorButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,11 @@ public class DoorManager : MonoBehaviour, IDescribable
|
||||
return type;
|
||||
}
|
||||
|
||||
public string GetDescribeName()
|
||||
{
|
||||
return mod;
|
||||
}
|
||||
|
||||
public string GetDescription()
|
||||
{
|
||||
return "Describe " + type;
|
||||
|
||||
@@ -141,6 +141,11 @@ public class GuardManager : MonoBehaviour, IDescribable
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public string GetDescribeName()
|
||||
{
|
||||
return mod;
|
||||
}
|
||||
|
||||
public string GetDescription()
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ public class MainMenuController : MonoBehaviour
|
||||
|
||||
public void PlaySelect()
|
||||
{
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
if (GlobalStateManager.Instance.HighestLevel >= GlobalStateManager.Instance.levels.Count)
|
||||
{
|
||||
//handle edge case of completing all the levels
|
||||
@@ -48,11 +49,13 @@ public class MainMenuController : MonoBehaviour
|
||||
|
||||
public void LevelSelect()
|
||||
{
|
||||
AudioManager.Instance.PlaySound("WordAdd");
|
||||
InstantiateLevelButtons();
|
||||
}
|
||||
|
||||
public void BackSelect()
|
||||
{
|
||||
AudioManager.Instance.PlaySound("WordRemove");
|
||||
InitMenu.SetActive(true);
|
||||
LevelSelectMenu.SetActive(false);
|
||||
}
|
||||
@@ -78,7 +81,7 @@ public class MainMenuController : MonoBehaviour
|
||||
if (i <= GlobalStateManager.Instance.HighestLevel)
|
||||
{
|
||||
levelButton.GetComponentInChildren<Button>().onClick.AddListener(() => {
|
||||
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
GlobalStateManager.Instance.LoadSpecificLevel(levelIndex);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,11 @@ public class PauseController : MonoBehaviour
|
||||
|
||||
public void TogglePause(bool on)
|
||||
{
|
||||
if (GlobalStateManager.Instance != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
}
|
||||
|
||||
pauseMenu.SetActive(on);
|
||||
Time.timeScale = on ? 0 : 1;
|
||||
}
|
||||
@@ -16,6 +21,7 @@ public class PauseController : MonoBehaviour
|
||||
TogglePause(false);
|
||||
if (GlobalStateManager.Instance != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
GlobalStateManager.Instance.MenuIntended = intended;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@ using Utils;
|
||||
public class StatusManager : Singleton<StatusManager>
|
||||
{
|
||||
public Transform doorPanel;
|
||||
public Transform doorPanelThoughts;
|
||||
public GameObject doorPrefab;
|
||||
public Transform guardPanel;
|
||||
public Transform guardPanelThoughts;
|
||||
public GameObject guardPrefab;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
@@ -25,11 +27,18 @@ public class StatusManager : Singleton<StatusManager>
|
||||
|
||||
public void PopulatePanels()
|
||||
{
|
||||
PopulatePanel(doorPanel, doorPrefab, LevelLoader.Instance.Doors.Cast<IDescribable>().ToList(),LevelLoader.Instance.GlobalModifier == "HIDE");
|
||||
PopulatePanel(guardPanel, guardPrefab, LevelLoader.Instance.Guards.Cast<IDescribable>().ToList(), false);
|
||||
PopulatePanel(doorPanel, doorPrefab, LevelLoader.Instance.Doors.Cast<IDescribable>().ToList(),false, LevelLoader.Instance.GlobalModifier == "HIDE");
|
||||
PopulatePanel(guardPanel, guardPrefab, LevelLoader.Instance.Guards.Cast<IDescribable>().ToList(), false, false);
|
||||
|
||||
PopulatePanel(doorPanelThoughts, doorPrefab, LevelLoader.Instance.Doors.Cast<IDescribable>().ToList(),true, LevelLoader.Instance.GlobalModifier == "HIDE");
|
||||
PopulatePanel(guardPanelThoughts, guardPrefab, LevelLoader.Instance.Guards.Cast<IDescribable>().ToList(), true, false);
|
||||
|
||||
//hide side pannel if cup global mod, or if only one guard
|
||||
//add fallback to getdescribename
|
||||
//actually implement the setting of predictions
|
||||
}
|
||||
|
||||
private void PopulatePanel(Transform panel, GameObject template, List<IDescribable> items, bool hide)
|
||||
private void PopulatePanel(Transform panel, GameObject template, List<IDescribable> items, bool interactableType, bool hide)
|
||||
{
|
||||
foreach (Transform child in panel)
|
||||
{
|
||||
@@ -40,20 +49,28 @@ public class StatusManager : Singleton<StatusManager>
|
||||
{
|
||||
var obj = Instantiate(template, panel);
|
||||
|
||||
|
||||
var titleMesh = obj.transform.FindChildRecursive("TITLE").GetComponent<TextMeshProUGUI>();
|
||||
var descMesh = obj.transform.FindChildRecursive("DESC").GetComponent<TextMeshProUGUI>();
|
||||
|
||||
if (hide)
|
||||
if (!interactableType)
|
||||
{
|
||||
titleMesh.text = "???";
|
||||
descMesh.text = "???";
|
||||
if (hide)
|
||||
{
|
||||
titleMesh.text = "???";
|
||||
descMesh.text = "???";
|
||||
}
|
||||
else
|
||||
{
|
||||
titleMesh.text = item.GetName();
|
||||
descMesh.text = item.GetDescription();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
titleMesh.text = item.GetName();
|
||||
descMesh.text = item.GetDescription();
|
||||
titleMesh.text = item.GetDescribeName();
|
||||
descMesh.text = "Click to set prediction";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ namespace Utils
|
||||
public interface IDescribable
|
||||
{
|
||||
public string GetName();
|
||||
|
||||
public string GetDescribeName();
|
||||
|
||||
public string GetDescription();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user