diff --git a/SSLR/Assets/Scenes/LiviPlayground.unity b/SSLR/Assets/Scenes/LiviPlayground.unity index 38473a8..eecc8c8 100644 --- a/SSLR/Assets/Scenes/LiviPlayground.unity +++ b/SSLR/Assets/Scenes/LiviPlayground.unity @@ -818,6 +818,7 @@ GameObject: - component: {fileID: 520849215} - component: {fileID: 520849216} - component: {fileID: 520849217} + - component: {fileID: 520849218} m_Layer: 0 m_Name: Game Manager m_TagString: Untagged @@ -866,6 +867,18 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: npcObject: {fileID: 624452548} +--- !u!114 &520849218 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520849214} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 453d520beb5656b4b8f3e696d9a97205, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &624452548 GameObject: m_ObjectHideFlags: 0 diff --git a/SSLR/Assets/Scripts/DeskButtons.cs b/SSLR/Assets/Scripts/DeskButtons.cs index a1503d7..dc79a74 100644 --- a/SSLR/Assets/Scripts/DeskButtons.cs +++ b/SSLR/Assets/Scripts/DeskButtons.cs @@ -63,11 +63,15 @@ public class DeskButtons : MonoBehaviour { if (correctDirection == directionSent) { + Player.score += 1; Debug.Log("correct"); + Debug.Log(Player.score); } else { + Player.score -= 1; Debug.Log("incorrect"); + Debug.Log(Player.score); } } } diff --git a/SSLR/Assets/Scripts/Player.cs b/SSLR/Assets/Scripts/Player.cs new file mode 100644 index 0000000..9a8e82d --- /dev/null +++ b/SSLR/Assets/Scripts/Player.cs @@ -0,0 +1,36 @@ +/* + * Author: Livinia Poo + * Date: 1/2/25 + * Description: + * Player Handling + */ + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Player : MonoBehaviour +{ + public static int score = 0; + + private GameManager gm; + + void Start() + { + gm = GameObject.Find("Game Manager").GetComponent(); + } + + void Update() + { + CheckDayEnd(); + } + + void CheckDayEnd() + { + if (score <= 0) + { + Debug.Log("Game Over, Day has ended"); + gm.dayEnded = true; + } + } +} diff --git a/SSLR/Assets/Scripts/Player.cs.meta b/SSLR/Assets/Scripts/Player.cs.meta new file mode 100644 index 0000000..bf19cdb --- /dev/null +++ b/SSLR/Assets/Scripts/Player.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 453d520beb5656b4b8f3e696d9a97205 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: