diff --git a/IronToad_UnityProject/Assets/Scripts/AlertController.cs b/IronToad_UnityProject/Assets/Scripts/AlertController.cs index 0054caa..23626a9 100644 --- a/IronToad_UnityProject/Assets/Scripts/AlertController.cs +++ b/IronToad_UnityProject/Assets/Scripts/AlertController.cs @@ -17,14 +17,12 @@ public class AlertController : MonoBehaviour NotificationServer.register("spotted boat", spottedBoat); NotificationServer.register("lost boat", lostBoat); NotificationServer.register("restart scene", restartScene); -// originalPos = text.rectTransform.anchoredPosition3D; } public void spottedBoat() { LeanTween.cancel(text.gameObject, false); LeanTween.cancel(slider.gameObject, false); -// lastSpotted = Time.timeSinceLevelLoad; NotificationServer.notify("show AlertText"); text.text = "hide!"; setTimer(0f); diff --git a/IronToad_UnityProject/Assets/Scripts/AudioController.cs b/IronToad_UnityProject/Assets/Scripts/AudioController.cs index cc422a7..d5f837a 100644 --- a/IronToad_UnityProject/Assets/Scripts/AudioController.cs +++ b/IronToad_UnityProject/Assets/Scripts/AudioController.cs @@ -27,6 +27,7 @@ public class AudioController : MonoBehaviour NotificationServer.register("fade amb", fadeAmb); NotificationServer.register("statechange Searchlight", searchlightStateChanged); + NotificationServer.register("restart scene", restartScene); } void Start() @@ -75,6 +76,10 @@ public class AudioController : MonoBehaviour } } + public void restartScene() + { + searchState = Searchlight.SearchState.Spline; + } public void playAmb(object audioNameObj) { diff --git a/IronToad_UnityProject/Assets/Scripts/LightBeam.cs b/IronToad_UnityProject/Assets/Scripts/LightBeam.cs index ef13401..711a5fa 100644 --- a/IronToad_UnityProject/Assets/Scripts/LightBeam.cs +++ b/IronToad_UnityProject/Assets/Scripts/LightBeam.cs @@ -31,6 +31,7 @@ public class LightBeam : MonoBehaviour { } private void resetState() { + searchState = Searchlight.SearchState.Spline; lightBeam.gameObject.SetActive(true); target.gameObject.SetActive(true); GetComponent().SetBool("isSeen", false); diff --git a/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs index f4d2e23..9ca212d 100644 --- a/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs +++ b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs @@ -77,6 +77,8 @@ public class LighthouseLanding : MonoBehaviour public void restartScene() { + searchState = Searchlight.SearchState.Spline; switchedOff = false; + isTriggering = false; } } diff --git a/IronToad_UnityProject/Assets/Scripts/Searchlight.cs b/IronToad_UnityProject/Assets/Scripts/Searchlight.cs index e419ddc..ea1a34c 100644 --- a/IronToad_UnityProject/Assets/Scripts/Searchlight.cs +++ b/IronToad_UnityProject/Assets/Scripts/Searchlight.cs @@ -32,7 +32,7 @@ public class Searchlight : MonoBehaviour { foreach (Searchlight sl in instants) { - if (sl.isTriggering) + if (sl.isActiveAndEnabled && sl.isTriggering) return true; } return false; @@ -43,9 +43,9 @@ public class Searchlight : MonoBehaviour NotificationServer.register("statechange Searchlight safe", stateSafe); NotificationServer.register("statechange Searchlight returning", stateReturning); NotificationServer.register("spotted boat", spottedBoat); + NotificationServer.register("restart scene", stateSafe); if (!instants.Contains(this)) instants.Add(this); - } void OnTriggerEnter(Collider other) @@ -80,6 +80,7 @@ public class Searchlight : MonoBehaviour public void stateSafe() { state = SearchState.Spline; + isTriggering = false; LeanTween.cancel(chaseID, false); } diff --git a/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs b/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs index 529263e..1321274 100644 --- a/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs +++ b/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs @@ -17,6 +17,7 @@ public class VictoryScript : MonoBehaviour isTriggering = true; NotificationServer.notify("show VictoryButton"); + NotificationServer.register("restart scene", restartScene); } void OnTriggerExit(Collider other) @@ -48,4 +49,9 @@ public class VictoryScript : MonoBehaviour NotificationServer.notify("show VictoryPanel"); NotificationServer.notify("hide GameUI"); } + + public void restartScene() + { + isTriggering = false; + } } diff --git a/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity b/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity index 5b0f5ad..5964585 100644 Binary files a/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity and b/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity differ