game: more scenario reactions

This commit is contained in:
kookiekenobi 2025-02-01 03:42:06 +08:00
parent e4d4d29444
commit 3e3d1dd48e
4 changed files with 64 additions and 0 deletions

View file

@ -818,6 +818,7 @@ GameObject:
- component: {fileID: 520849215} - component: {fileID: 520849215}
- component: {fileID: 520849216} - component: {fileID: 520849216}
- component: {fileID: 520849217} - component: {fileID: 520849217}
- component: {fileID: 520849218}
m_Layer: 0 m_Layer: 0
m_Name: Game Manager m_Name: Game Manager
m_TagString: Untagged m_TagString: Untagged
@ -866,6 +867,18 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
npcObject: {fileID: 624452548} 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 --- !u!1 &624452548
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -63,11 +63,15 @@ public class DeskButtons : MonoBehaviour
{ {
if (correctDirection == directionSent) if (correctDirection == directionSent)
{ {
Player.score += 1;
Debug.Log("correct"); Debug.Log("correct");
Debug.Log(Player.score);
} }
else else
{ {
Player.score -= 1;
Debug.Log("incorrect"); Debug.Log("incorrect");
Debug.Log(Player.score);
} }
} }
} }

View file

@ -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<GameManager>();
}
void Update()
{
CheckDayEnd();
}
void CheckDayEnd()
{
if (score <= 0)
{
Debug.Log("Game Over, Day has ended");
gm.dayEnded = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 453d520beb5656b4b8f3e696d9a97205
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: