Add tutorial system. Fox bugs raised by the group chat

This commit is contained in:
WillJeynes
2026-08-29 19:51:34 +01:00
parent 44c59c425c
commit fec7b392b5
23 changed files with 1075 additions and 124 deletions
+2
View File
@@ -227,12 +227,14 @@ public class CameraController : MonoBehaviour
if (guard != null)
{
TutorialManager.Instance.LogAction("TAP");
currentGuardManager = guard;
guard.isfocussed = 2;
if (talkButton != null) talkButton.gameObject.SetActive(true);
}
else if (door != null)
{
TutorialManager.Instance.LogAction("TAP");
currentDoorManager = door;
door.isfocussed = 2;
if (doorButton != null) doorButton.gameObject.SetActive(true);
+29 -7
View File
@@ -69,15 +69,15 @@ public class DoorManager : MonoBehaviour, IDescribable
// Update is called once per frame
void Update()
{
if (isfocussed == 2 && focusLight.intensity < 200)
if (isfocussed == 2 && focusLight.intensity < 250)
{
focusLight.intensity += Time.deltaTime * 100;
}
else if (isfocussed == 1 && focusLight.intensity < 100)
else if (isfocussed == 1 && focusLight.intensity < 150)
{
focusLight.intensity += Time.deltaTime * 100;
}
else if (isfocussed == 0 && focusLight.intensity > 60)
else if (isfocussed == 0 && focusLight.intensity > 100)
{
focusLight.intensity -= Time.deltaTime * 100;
}
@@ -123,24 +123,46 @@ public class DoorManager : MonoBehaviour, IDescribable
public string GetName()
{
return type;
if (type == "LIFE")
{
return "Door of Eden";
}
else if (type == "DEATH")
{
return "Door of Oblivion";
}
else
{
return "Door no one has ever tried";
}
}
public string GetDescribeName()
{
if (!string.IsNullOrEmpty(mod))
{
return mod;
return "The " + mod.ToLower() + " door";
}
else
{
return "normal door";
return "Normal door";
}
}
public string GetDescription()
{
return "Describe " + type;
if (type == "LIFE")
{
return "Leads to the next level of the castle.";
}
else if (type == "DEATH")
{
return "Leads to certain death, in some brutal fashion.";
}
else
{
return "Dunno whats behind it..";
}
}
public string GetUnknownDescription()
+28 -13
View File
@@ -46,15 +46,15 @@ public class GuardManager : MonoBehaviour, IDescribable
// Update is called once per frame
void Update()
{
if (isfocussed == 2 && focusLight.intensity < 200)
if (isfocussed == 2 && focusLight.intensity < 250)
{
focusLight.intensity += Time.deltaTime * 100;
}
else if (isfocussed == 1 && focusLight.intensity < 100)
else if (isfocussed == 1 && focusLight.intensity < 150)
{
focusLight.intensity += Time.deltaTime * 100;
}
else if (isfocussed == 0 && focusLight.intensity > 60)
else if (isfocussed == 0 && focusLight.intensity > 100)
{
focusLight.intensity -= Time.deltaTime * 100;
}
@@ -148,24 +148,39 @@ public class GuardManager : MonoBehaviour, IDescribable
public string GetName()
{
return type;
if (type == "TRUTHER")
{
return "Veritas";
}
else if (type == "LIAR")
{
return "Vesper";
}
else
{
return "Jester";
}
}
public string GetDescribeName()
{
if (!string.IsNullOrEmpty(mod))
{
return mod;
}
else
{
return "plain guard";
}
return GetUnknownDescription().CapitalizeFirstLetter();
}
public string GetDescription()
{
return "Describe " + type;
if (type == "TRUTHER")
{
return "Sworn by oath to always tell the truth, at all costs.";
}
else if (type == "LIAR")
{
return "Cursed to always tell the opposite of the truth, no matter his real intentions.";
}
else
{
return "Things are slow in the King's chamber, comes down here for laughs.";
}
}
public string GetUnknownDescription()
+2
View File
@@ -132,6 +132,8 @@ public class LevelLoader : Singleton<LevelLoader>
});
}
TutorialManager.Instance.ShowFirst();
}
+1
View File
@@ -39,6 +39,7 @@ public class SpeechManager : Singleton<SpeechManager>
public void HandlePress()
{
TutorialManager.Instance.LogAction("DIA");
if (fulltext != null)
{
StopCoroutine(ccoroutine);
+3 -1
View File
@@ -29,7 +29,7 @@ public class StatusManager : Singleton<StatusManager>
public void PopulatePanels()
{
PopulatePanel(doorPanel, doorPrefab, LevelLoader.Instance.Doors.Cast<IDescribable>().ToList().Shuffle(),false, LevelLoader.Instance.GlobalModifier == "HIDE");
PopulatePanel(guardPanel, guardPrefab, LevelLoader.Instance.Guards.Cast<IDescribable>().ToList().Shuffle(), false, false);
PopulatePanel(guardPanel, doorPrefab, LevelLoader.Instance.Guards.Cast<IDescribable>().ToList().Shuffle(), 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);
@@ -85,6 +85,8 @@ public class StatusManager : Singleton<StatusManager>
public void TogglePanel(RectTransform panel)
{
TutorialManager.Instance.LogAction("SIDE");
if (!panelStates.ContainsKey(panel))
panelStates[panel] = false; // Initially closed
+43
View File
@@ -0,0 +1,43 @@
using System.Collections.Generic;
using UnityEngine;
using Utils;
using Utils.Utils;
public class TutorialManager : Singleton<TutorialManager>
{
public List<GameEntry<GameObject>> tutorialOne;
public List<GameEntry<GameObject>> tutorialTwo;
private int index = 0;
public void LogAction(string action)
{
if (LevelLoader.Instance.GlobalModifier != "TUT1" && LevelLoader.Instance.GlobalModifier != "TUT2")
{
return;
}
var tutorial = LevelLoader.Instance.GlobalModifier == "TUT1" ? tutorialOne : tutorialTwo;
if (index < tutorial.Count && tutorial[index].key == action)
{
tutorial[index].value.SetActive(false);
index++;
if (index < tutorial.Count)
{
tutorial[index].value.SetActive(true);
}
}
}
public void ShowFirst()
{
if (LevelLoader.Instance.GlobalModifier != "TUT1" && LevelLoader.Instance.GlobalModifier != "TUT2")
{
return;
}
var tutorial = LevelLoader.Instance.GlobalModifier == "TUT1" ? tutorialOne : tutorialTwo;
tutorial[index].value.SetActive(true);
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: aa525461e0ec0406aaab0cc263ba9dda
+8
View File
@@ -11,5 +11,13 @@ namespace Utils
: str.Remove(index, oldValue.Length)
.Insert(index, newValue);
}
public static string CapitalizeFirstLetter(this string input)
{
if (string.IsNullOrEmpty(input))
return input;
return char.ToUpper(input[0]) + input.Substring(1);
}
}
}