game: timer text

This commit is contained in:
kookiekenobi 2025-02-18 04:41:11 +08:00
parent d1ff77f57c
commit 403195fdc8
3 changed files with 38 additions and 67 deletions

View file

@ -469,67 +469,6 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4704910962696626565, guid: 00134d40eee1ff84eb904a98548ec295, type: 3}
m_PrefabInstance: {fileID: 448564655}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &19932811
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalPosition.x
value: 732.117
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalPosition.y
value: 11.630854
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalPosition.z
value: 457.699
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalRotation.w
value: -0.00000016391273
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalRotation.x
value: 2.3092636e-14
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalRotation.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalRotation.z
value: 0.000000014901159
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -180
objectReference: {fileID: 0}
- target: {fileID: 987810662684709338, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7198325426086921740, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_Name
value: Spawnable_Doc
objectReference: {fileID: 0}
- target: {fileID: 7198325426086921740, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e82a63e1655bf9645aba4697304f862d, type: 3}
--- !u!1001 &20416343
PrefabInstance:
m_ObjectHideFlags: 0
@ -37474,6 +37413,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8950253087972865307, guid: 300994ef4bdec2a42b6dd3eabe7270e2, type: 3}
m_PrefabInstance: {fileID: 1123801392}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1124183581 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4562939406878164559, guid: 298bd5f29cfba0b409e325602c23f9a6, type: 3}
m_PrefabInstance: {fileID: 3957114709122374967}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1125101797
PrefabInstance:
m_ObjectHideFlags: 0
@ -55165,7 +55115,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0bab791ccf13189449b82b8f0b70b269, type: 3}
m_Name:
m_EditorClassIdentifier:
shiftDuration: 120
shiftDuration: 180
timerText: {fileID: 1124183581}
--- !u!65 &1779211428
BoxCollider:
m_ObjectHideFlags: 0
@ -64885,6 +64836,10 @@ PrefabInstance:
propertyPath: m_Name
value: digitalClock
objectReference: {fileID: 0}
- target: {fileID: 4562939406878164559, guid: 298bd5f29cfba0b409e325602c23f9a6, type: 3}
propertyPath: m_text
value: 3:00
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -67154,7 +67109,6 @@ SceneRoots:
- {fileID: 9021714893489400252}
- {fileID: 3957114709122374967}
- {fileID: 1195857307}
- {fileID: 19932811}
- {fileID: 1626285534}
- {fileID: 181151630}
- {fileID: 990127396}

View file

@ -70,7 +70,7 @@ public class DayManager : MonoBehaviour
Debug.Log("Day completed!");
/*Backend.instance.User.daysPlayed += 1;
Debug.Log(Backend.instance.User.daysPlayed);*/
shiftManagerScript.AllowShiftStart();
/*shiftManagerScript.AllowShiftStart();*/
Debug.Log("You can start another shift!");
doneAShift = false;

View file

@ -7,6 +7,7 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class ShiftManager : MonoBehaviour
@ -31,6 +32,11 @@ public class ShiftManager : MonoBehaviour
/// Day manager reference
/// </summary>
private DayManager dayManager;
/// <summary>
/// Displaying the timer
/// </summary>
public TextMeshProUGUI timerText;
/// <summary>
/// Assigning variables and references
@ -72,6 +78,7 @@ public class ShiftManager : MonoBehaviour
while (remainingTime > 0)
{
remainingTime -= Time.deltaTime;
UpdateTimerText();
if (Player.score < 0)
{
@ -91,9 +98,9 @@ public class ShiftManager : MonoBehaviour
void EndShift()
{
Debug.Log("Shift ended!");
/*npcSpawnArea.SetActive(false);*/
remainingTime = shiftDuration;
timerText.text = "3:00";
gm.shiftStarted = false;
dayManager.doneAShift = true;
NpcManager.instance.EndDay();
@ -102,8 +109,18 @@ public class ShiftManager : MonoBehaviour
/// <summary>
/// Start next day shift
/// </summary>
public void AllowShiftStart()
/*public void AllowShiftStart()
{
shiftTrigger.enabled = true;
}*/
/// <summary>
/// Formatting timer text
/// </summary>
void UpdateTimerText()
{
int minutes = Mathf.FloorToInt(remainingTime / 60);
int seconds = Mathf.FloorToInt(remainingTime % 60);
timerText.text = string.Format("{0}:{1:00}", minutes, seconds);
}
}