game: continuing game flow

This commit is contained in:
rezazfn 2025-02-11 09:55:06 +08:00
parent 1b7b5d06e5
commit d2b711e6a7
5 changed files with 5094 additions and 14 deletions

File diff suppressed because one or more lines are too long

View file

@ -7,19 +7,41 @@ Description: Detects dirt and sweeps them up
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class BroomSweeping : MonoBehaviour
{
private GameManager gameManager;
private PostProcessingManager postProcessingManager;
// To track how much trash has been collected so far
public int dirtSweeped = 0;
// Defines how much trash is needed to collect in order to unlock the door
public int dirtRequired = 10;
// Defines UI references
[Header("UI References")]
public GameObject storyPanelUI;
public TMP_Text storyText;
// Defines Audio References
[Header("Audio References")]
public AudioSource audioSource;
public AudioClip sweepingSound;
// Update is called once per frame
void Update()
{
if (dirtSweeped >= dirtRequired)
{
GameManager.Instance.FloorSweepedTaskComplete();
storyText.text = "I hope the house is clean enough now so I don't get scolded later...";
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 7f));
}
}
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Dirt"))
@ -37,4 +59,10 @@ public class BroomSweeping : MonoBehaviour
}
}
}
private IEnumerator HideMessageAfterSeconds(GameObject uiElement, float delay)
{
// Waits for delay to end and hides the UI
yield return new WaitForSeconds(delay);
uiElement.SetActive(false);
}
}

View file

@ -11,6 +11,7 @@ using UnityEngine.UI;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine.XR.Interaction.Toolkit.Interactables;
using UnityEngine.XR.Interaction.Toolkit.Interactors;
using TMPro;
public class BrushTeeth : MonoBehaviour
{
@ -22,7 +23,14 @@ public class BrushTeeth : MonoBehaviour
private float timer = 0f;
private bool isGrabbing = false;
// Audio References
// Defines UI references
[Header("UI References")]
public GameObject storyPanelUI;
public TMP_Text storyText;
// Defines Audio References
[Header("Audio References")]
public AudioSource audioSource;
public AudioClip brushingSound;
@ -111,6 +119,9 @@ public class BrushTeeth : MonoBehaviour
GameManager.Instance.BrushTeethTaskComplete();
storyText.text = "I should be fresh enough to go to school now...";
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 7f));
Debug.Log("Progress completed!");
}
@ -122,4 +133,11 @@ public class BrushTeeth : MonoBehaviour
grabInteractable.selectExited.RemoveListener(OnRelease);
}
}
private IEnumerator HideMessageAfterSeconds(GameObject uiElement, float delay)
{
// Waits for delay to end and hides the UI
yield return new WaitForSeconds(delay);
uiElement.SetActive(false);
}
}

View file

@ -91,6 +91,4 @@ public class GameManager : MonoBehaviour
{
floorSweeped = true;
}
}

View file

@ -9,7 +9,7 @@
{
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.lastMeshSelectMode",
"value": "{\"m_Value\":2}"
"value": "{\"m_Value\":8}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
@ -111,6 +111,11 @@
"key": "editor.stripProBuilderScriptsOnBuild",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.extrudeEdgesAsGroup",
"value": "{\"m_Value\":true}"
},
{
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.rectSelectModifier",
@ -161,6 +166,11 @@
"key": "ShapeBuilder.LastPivotLocation",
"value": "{\"m_Value\":1}"
},
{
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "SubdivideEdges.subdivisions",
"value": "{\"m_Value\":1}"
},
{
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.newShapePivotLocation",
@ -174,7 +184,7 @@
{
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize",
"value": "{\"m_Value\":{\"x\":0.248779296875,\"y\":-0.09796714782714844,\"z\":0.2877197265625}}"
"value": "{\"m_Value\":{\"x\":-0.4071826934814453,\"y\":0.2012939453125,\"z\":-0.5807037353515625}}"
},
{
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
@ -250,6 +260,11 @@
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "uv.uvEditorGridSnapIncrement",
"value": "{\"m_Value\":0.125}"
},
{
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "ExtrudeEdges.distance",
"value": "{\"m_Value\":0.5}"
}
]
}