diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 17f9e79e..ed5feb32 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -323,6 +323,7 @@ + diff --git a/Assets/ContinueButton.cs b/Assets/ContinueButton.cs new file mode 100644 index 00000000..ee34e62c --- /dev/null +++ b/Assets/ContinueButton.cs @@ -0,0 +1,33 @@ +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +public class ContinueButton : MonoBehaviour +{ + Color greyscale => new Color(1f, 1f, 1f, 0.3f); + Color greyscaletext => new Color(50f, 50f, 50f, 0.3f); + + // Start is called before the first frame update + void Start() + { + GameObject continueButton = GameObject.Find("ContinueButton"); + + TMP_Text m_TextComponent; + m_TextComponent = GameObject.Find("ContinueText").GetComponent (); + + + if (!PlayerPrefs.HasKey("SceneSaved")) + { + continueButton.GetComponent().color = greyscaletext; + m_TextComponent.color = greyscaletext; + } + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/ContinueButton.cs.meta b/Assets/ContinueButton.cs.meta new file mode 100644 index 00000000..ca3aeb2b --- /dev/null +++ b/Assets/ContinueButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e44f20bba37308745b213d8247feb6b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NewGame.cs b/Assets/NewGame.cs index 851320c2..7120878a 100644 --- a/Assets/NewGame.cs +++ b/Assets/NewGame.cs @@ -43,7 +43,6 @@ public class NewGame : MonoBehaviour float health = 10.0f; PlayerPrefs.SetFloat("maxHealth", 10); PlayerPrefs.SetFloat("health", 10); - PlayerPrefs.SetInt("HasEverPlayed",1); //PlayerPrefs.SetInt("continued", 0); PlayerPrefs.SetInt("rock", 0); // Is it used anywhere? I have not found it diff --git a/Assets/Scenes/Main Menu.unity b/Assets/Scenes/Main Menu.unity index d46fb397..dc2cc5de 100644 --- a/Assets/Scenes/Main Menu.unity +++ b/Assets/Scenes/Main Menu.unity @@ -564,6 +564,7 @@ GameObject: - component: {fileID: 455923087} - component: {fileID: 455923090} - component: {fileID: 455923091} + - component: {fileID: 455923092} m_Layer: 5 m_Name: ContinueButton m_TagString: Untagged @@ -721,6 +722,18 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a1bf3e868faa974eacf1ae8d9407255, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &455923092 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 455923085} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e44f20bba37308745b213d8247feb6b9, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &502516633 GameObject: m_ObjectHideFlags: 0 @@ -890,7 +903,7 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 680041739} m_TargetAssemblyTypeName: ChangeScene, Assembly-CSharp - m_MethodName: MoveToScene + m_MethodName: MoveToSceneFirst m_Mode: 3 m_Arguments: m_ObjectArgument: {fileID: 0} diff --git a/Assets/Scripts/ChangeScene.cs b/Assets/Scripts/ChangeScene.cs index 687bbe4c..ac5641bd 100644 --- a/Assets/Scripts/ChangeScene.cs +++ b/Assets/Scripts/ChangeScene.cs @@ -3,27 +3,56 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using System; +using System.Diagnostics; +using Debug = UnityEngine.Debug; public class ChangeScene : MonoBehaviour { float x, y, z; + private Animator myanim; + + public void MoveToScene(int sceneID) { SceneManager.LoadScene(sceneID); } + + public void MoveToSceneFirst(int sceneID) + { + //Scene current = SceneManager.GetActiveScene(); + //Debug.Log(PlayerPrefs.HasKey("HER")); + if (!PlayerPrefs.HasKey("SceneSaved")) + { + SceneManager.LoadScene(5); + } + else + { + SceneManager.LoadScene(sceneID); + } + + } + void Start(){ } - + private void Awake() + { + } + + private void Update() + { + } + private IEnumerator WaitForAnimationAndMoveToScene(float waitTime, Collision2D collision) { while (true) { yield return new WaitForSeconds(waitTime); + Debug.Log("BEFORE"); collision.gameObject.GetComponent().ScenetToMoveTo(); - + Debug.Log("AFTER"); } } @@ -38,8 +67,11 @@ public class ChangeScene : MonoBehaviour if(collision.gameObject.tag == "AnimatedDoorSceneTransition") { Debug.Log("Starting coroutine"); - + Debug.Log(TriggerDoor.ableToOpen); + if (TriggerDoor.ableToOpen) + { StartCoroutine(WaitForAnimationAndMoveToScene(0.3f, collision)); + } } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/Door/TriggerDoor.cs b/Assets/Scripts/Door/TriggerDoor.cs index 38f67c4d..f5bead4a 100644 --- a/Assets/Scripts/Door/TriggerDoor.cs +++ b/Assets/Scripts/Door/TriggerDoor.cs @@ -6,7 +6,7 @@ public class TriggerDoor : DetectionZone { public string DoorOpenAnimatorParamName = "DoorOpen"; public static bool ableToOpen = false; - Animator animator; + public static Animator animator; void Start(){ animator = GetComponent(); @@ -14,11 +14,14 @@ public class TriggerDoor : DetectionZone void Update() { if(detectedObjs.Count > 0) { - animator.SetBool(DoorOpenAnimatorParamName, true); + //if (Input.GetKeyDown(KeyCode.E)) + //{ + animator.SetBool(DoorOpenAnimatorParamName, true); ableToOpen = true; - + //} } else { animator.SetBool(DoorOpenAnimatorParamName, false); + ableToOpen = false; } } diff --git a/Assets/Scripts/SaveController.cs b/Assets/Scripts/SaveController.cs index 5dbfa04a..1caba6e2 100644 --- a/Assets/Scripts/SaveController.cs +++ b/Assets/Scripts/SaveController.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine;