game: continuing game flow
This commit is contained in:
parent
1b7b5d06e5
commit
d2b711e6a7
5 changed files with 5094 additions and 14 deletions
File diff suppressed because one or more lines are too long
|
@ -7,19 +7,41 @@ Description: Detects dirt and sweeps them up
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
public class BroomSweeping : MonoBehaviour
|
public class BroomSweeping : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private GameManager gameManager;
|
||||||
|
private PostProcessingManager postProcessingManager;
|
||||||
|
|
||||||
// To track how much trash has been collected so far
|
// To track how much trash has been collected so far
|
||||||
public int dirtSweeped = 0;
|
public int dirtSweeped = 0;
|
||||||
|
|
||||||
// Defines how much trash is needed to collect in order to unlock the door
|
// Defines how much trash is needed to collect in order to unlock the door
|
||||||
public int dirtRequired = 10;
|
public int dirtRequired = 10;
|
||||||
|
|
||||||
|
// Defines UI references
|
||||||
|
[Header("UI References")]
|
||||||
|
public GameObject storyPanelUI;
|
||||||
|
public TMP_Text storyText;
|
||||||
|
|
||||||
// Defines Audio References
|
// Defines Audio References
|
||||||
|
[Header("Audio References")]
|
||||||
public AudioSource audioSource;
|
public AudioSource audioSource;
|
||||||
public AudioClip sweepingSound;
|
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)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
if (!other.CompareTag("Dirt"))
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,7 @@ using UnityEngine.UI;
|
||||||
using UnityEngine.XR.Interaction.Toolkit;
|
using UnityEngine.XR.Interaction.Toolkit;
|
||||||
using UnityEngine.XR.Interaction.Toolkit.Interactables;
|
using UnityEngine.XR.Interaction.Toolkit.Interactables;
|
||||||
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
public class BrushTeeth : MonoBehaviour
|
public class BrushTeeth : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
@ -22,7 +23,14 @@ public class BrushTeeth : MonoBehaviour
|
||||||
private float timer = 0f;
|
private float timer = 0f;
|
||||||
private bool isGrabbing = false;
|
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 AudioSource audioSource;
|
||||||
public AudioClip brushingSound;
|
public AudioClip brushingSound;
|
||||||
|
|
||||||
|
@ -110,6 +118,9 @@ public class BrushTeeth : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
GameManager.Instance.BrushTeethTaskComplete();
|
GameManager.Instance.BrushTeethTaskComplete();
|
||||||
|
|
||||||
|
storyText.text = "I should be fresh enough to go to school now...";
|
||||||
|
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 7f));
|
||||||
|
|
||||||
Debug.Log("Progress completed!");
|
Debug.Log("Progress completed!");
|
||||||
}
|
}
|
||||||
|
@ -122,4 +133,11 @@ public class BrushTeeth : MonoBehaviour
|
||||||
grabInteractable.selectExited.RemoveListener(OnRelease);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,4 @@ public class GameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
floorSweeped = true;
|
floorSweeped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{
|
{
|
||||||
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "editor.lastMeshSelectMode",
|
"key": "editor.lastMeshSelectMode",
|
||||||
"value": "{\"m_Value\":2}"
|
"value": "{\"m_Value\":8}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
|
@ -111,6 +111,11 @@
|
||||||
"key": "editor.stripProBuilderScriptsOnBuild",
|
"key": "editor.stripProBuilderScriptsOnBuild",
|
||||||
"value": "{\"m_Value\":true}"
|
"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",
|
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "editor.rectSelectModifier",
|
"key": "editor.rectSelectModifier",
|
||||||
|
@ -161,6 +166,11 @@
|
||||||
"key": "ShapeBuilder.LastPivotLocation",
|
"key": "ShapeBuilder.LastPivotLocation",
|
||||||
"value": "{\"m_Value\":1}"
|
"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",
|
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "mesh.newShapePivotLocation",
|
"key": "mesh.newShapePivotLocation",
|
||||||
|
@ -174,7 +184,7 @@
|
||||||
{
|
{
|
||||||
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "ShapeBuilder.LastSize",
|
"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",
|
"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",
|
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
"key": "uv.uvEditorGridSnapIncrement",
|
"key": "uv.uvEditorGridSnapIncrement",
|
||||||
"value": "{\"m_Value\":0.125}"
|
"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}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue