Compare commits

...

4 commits

9 changed files with 54 additions and 44 deletions

View file

@ -33,7 +33,7 @@ public class AudioLoop : MonoBehaviour
audioSource.Stop(); // Pause the audio audioSource.Stop(); // Pause the audio
yield return new WaitForSeconds(15f); // Pause for 15 seconds yield return new WaitForSeconds(15f); // Pause for 15 seconds
} }
// NOTE: are we really just going to let this stay alive forever // NOTE: are we really just going to let this stay alive forever
// ReSharper disable once IteratorNeverReturns // ReSharper disable once IteratorNeverReturns
} }

View file

@ -125,7 +125,7 @@ public class BedroomTask : MonoBehaviour
// If the player has collected/ thrown the required amount of trash // If the player has collected/ thrown the required amount of trash
if (trashCollected < trashRequired) return; if (trashCollected < trashRequired) return;
if (GameManager.Instance == null) if (GameManager.Instance == null)
Debug.LogError("GameManager instance is null!"); Debug.LogError("GameManager instance is null!");
else else

View file

@ -34,7 +34,7 @@ public class BroomSweeping : MonoBehaviour
private void Update() private void Update()
{ {
if (dirtSweepCount < dirtRequired || _taskCompleted) return; if (dirtSweepCount < dirtRequired || _taskCompleted) return;
_taskCompleted = true; _taskCompleted = true;
GameManager.Instance.FloorSweepedTaskComplete(); GameManager.Instance.FloorSweepedTaskComplete();
@ -48,7 +48,7 @@ public class BroomSweeping : MonoBehaviour
{ {
// Now correctly checks for "Dirt" before triggering // Now correctly checks for "Dirt" before triggering
if (!other.CompareTag("Dirt")) return; if (!other.CompareTag("Dirt")) return;
dirtSweepCount++; dirtSweepCount++;
// Destroy it to prevent extra counting // Destroy it to prevent extra counting

View file

@ -54,7 +54,7 @@ public class BrushTeeth : MonoBehaviour
private void Update() private void Update()
{ {
if (!_isGrabbing || _taskCompleted) return; if (!_isGrabbing || _taskCompleted) return;
_timer += Time.deltaTime; _timer += Time.deltaTime;
progressBar.value = _timer / progressTime; progressBar.value = _timer / progressTime;
@ -64,7 +64,7 @@ public class BrushTeeth : MonoBehaviour
private void OnDestroy() private void OnDestroy()
{ {
if (_grabInteractable == null) return; if (_grabInteractable == null) return;
_grabInteractable.selectEntered.RemoveListener(OnGrab); _grabInteractable.selectEntered.RemoveListener(OnGrab);
_grabInteractable.selectExited.RemoveListener(OnRelease); _grabInteractable.selectExited.RemoveListener(OnRelease);
} }
@ -83,7 +83,7 @@ public class BrushTeeth : MonoBehaviour
// Play brushing sound while toothbrush is grabbed, plays only if it isn't playing already // Play brushing sound while toothbrush is grabbed, plays only if it isn't playing already
if (audioSource.isPlaying) return; if (audioSource.isPlaying) return;
audioSource.clip = brushingSound; audioSource.clip = brushingSound;
// Loops the sound for as long as the toothbrush is held; allows editable progress time // Loops the sound for as long as the toothbrush is held; allows editable progress time

View file

@ -9,7 +9,7 @@ using UnityEngine;
public class CameraGhostFollow : MonoBehaviour public class CameraGhostFollow : MonoBehaviour
{ {
public Transform target; // Usually the Main Camera (XR Rig's Head) public Transform target; // Usually the Main Camera (XR Rig's Head)
public float followSpeed = 5f; // How quickly it follows the target public float followSpeed = 5f; // How quickly it follows the target
public Vector3 offset = new(0, -0.2f, 1.5f); // Position offset public Vector3 offset = new(0, -0.2f, 1.5f); // Position offset
public bool followRotation = true; // Toggle for rotating with the head public bool followRotation = true; // Toggle for rotating with the head
@ -26,7 +26,7 @@ public class CameraGhostFollow : MonoBehaviour
// Smooth Rotation Follow (Yaw + Pitch) // Smooth Rotation Follow (Yaw + Pitch)
if (!followRotation) return; if (!followRotation) return;
// Capture target's full rotation // Capture target's full rotation
var targetEulerAngles = target.eulerAngles; var targetEulerAngles = target.eulerAngles;

View file

@ -31,7 +31,7 @@ public class Car : MonoBehaviour
{ {
// Check if the collider belongs to the player // Check if the collider belongs to the player
if (!other.CompareTag("Player")) return; if (!other.CompareTag("Player")) return;
Debug.Log("Teleporting Player..."); Debug.Log("Teleporting Player...");
TeleportPlayer(); TeleportPlayer();
} }

View file

@ -1,27 +1,30 @@
using System; /*
* Author: Mark
* Date: 10/2/2025
* Description: Playground test script for day incrementation and game manager state preservation
*/
using System.Collections; using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
public class DayIncrementPlaygroundScript : MonoBehaviour public class DayIncrementPlaygroundScript : MonoBehaviour
{ {
[SerializeField] public bool isBeforeScene = false; [SerializeField] public bool isBeforeScene;
private bool _testHasRun = false; private bool _testHasRun;
private void Update() private void Update()
{ {
if (_testHasRun) return; if (_testHasRun) return;
// fire off Main to run in the background // fire off Main to run in the background
StartCoroutine(Main()); StartCoroutine(Main());
_testHasRun = true; _testHasRun = true;
} }
IEnumerator Main() private IEnumerator Main()
{ {
if (isBeforeScene) if (isBeforeScene)
{ {
@ -30,24 +33,24 @@ public class DayIncrementPlaygroundScript : MonoBehaviour
yield return new WaitForSeconds(3); yield return new WaitForSeconds(3);
Debug.Log($"hello vro, day is {GameManager.Instance.currentDay}"); Debug.Log($"hello vro, day is {GameManager.Instance.currentDay}");
// get game manager and then increment the day // get game manager and then increment the day
GameManager.Instance.IncrementDay(); GameManager.Instance.IncrementDay();
Debug.Log($"post-increment day is {GameManager.Instance.currentDay}"); Debug.Log($"post-increment day is {GameManager.Instance.currentDay}");
// change to the next scene
SceneManager.LoadScene("Scenes/Testing Scenes/Day Increment Playground After");
// change to the next scene
// ReSharper disable once Unity.LoadSceneDisabledSceneName
SceneManager.LoadScene("Scenes/Testing Scenes/Day Increment Playground After");
} }
else else
{ {
// wait for 3 seconds // wait for 3 seconds
Debug.Log("initialisation wait..."); Debug.Log("initialisation wait...");
yield return new WaitForSeconds(3); yield return new WaitForSeconds(3);
Debug.Log($"hello vro, day is {GameManager.Instance.currentDay}"); Debug.Log($"hello vro, day is {GameManager.Instance.currentDay}");
} }
yield return 0; yield return 0;
} }
} }

View file

@ -1,3 +1,9 @@
/*
* Author: Mark
* Date: 31/1/2025
* Description: Dynamic configuration script for a drawer interactable
*/
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit.Interactables; using UnityEngine.XR.Interaction.Toolkit.Interactables;
@ -8,6 +14,7 @@ public class DrawerDynamicJointConfiguration : MonoBehaviour
{ {
[Header("mark's all-in-one dynamic drawer component")] [Header("mark's all-in-one dynamic drawer component")]
[Space(10)] [Space(10)]
#if UNITY_EDITOR
[HelpBox("make sure every child inside both prefabs are under the" + [HelpBox("make sure every child inside both prefabs are under the" +
"'Interactable Environment' layer.\n\n" + "'Interactable Environment' layer.\n\n" +
"whatever non-standard (a la ProBuilder) object geometry under the " + "whatever non-standard (a la ProBuilder) object geometry under the " +
@ -16,6 +23,7 @@ public class DrawerDynamicJointConfiguration : MonoBehaviour
"> 'Near-Far Interactor' > 'Curve Interaction Caster') should be have the " + "> 'Near-Far Interactor' > 'Curve Interaction Caster') should be have the " +
"'Interactable Environment' layer included in its' Raycast Mask.", "'Interactable Environment' layer included in its' Raycast Mask.",
HelpBoxMessageType.Error)] HelpBoxMessageType.Error)]
#endif
[Space(10)] [Space(10)]
[SerializeField] [SerializeField]
private MovementAxis movementAxis = MovementAxis.Z; private MovementAxis movementAxis = MovementAxis.Z;
@ -61,7 +69,7 @@ public class DrawerDynamicJointConfiguration : MonoBehaviour
bounciness = 0, bounciness = 0,
contactDistance = 0 contactDistance = 0
}; };
// configure the rigidbody // configure the rigidbody
var rb = GetComponent<Rigidbody>(); var rb = GetComponent<Rigidbody>();
rb.isKinematic = false; rb.isKinematic = false;

View file

@ -1,5 +1,9 @@
using System.Collections; /*
using System.Collections.Generic; * Author: Reza
* Date: 13/2/2025
* Description: Car obstacle
*/
using UnityEngine; using UnityEngine;
public class EffectTrigger : MonoBehaviour public class EffectTrigger : MonoBehaviour
@ -7,26 +11,21 @@ public class EffectTrigger : MonoBehaviour
// The effect name to trigger when the player enters this area // The effect name to trigger when the player enters this area
public string effectName; public string effectName;
// Check if the player enters the trigger zone
private void OnTriggerStay(Collider other)
{
// Check if the player is in the trigger zone
if (other.CompareTag("Player"))
{
// Trigger the effect based on the specified effectName
if (!PostProcessingManager.Instance.IsEffectActive())
{
PostProcessingManager.Instance.TriggerEffect(effectName);
}
}
}
// Optionally stop the effect when the player exits the trigger zone // Optionally stop the effect when the player exits the trigger zone
private void OnTriggerExit(Collider other) private void OnTriggerExit(Collider other)
{ {
if (other.CompareTag("Player") && PostProcessingManager.Instance.IsEffectActive()) if (other.CompareTag("Player") && PostProcessingManager.Instance.IsEffectActive())
{
PostProcessingManager.Instance.StopEffect(); PostProcessingManager.Instance.StopEffect();
} }
// Check if the player enters the trigger zone
private void OnTriggerStay(Collider other)
{
// Check if the player is in the trigger zone
if (!other.CompareTag("Player")) return;
// Trigger the effect based on the specified effectName
if (!PostProcessingManager.Instance.IsEffectActive())
PostProcessingManager.Instance.TriggerEffect(effectName);
} }
} }