game: misc

This commit is contained in:
rezazfn 2025-02-08 22:49:54 +08:00
parent d228d1cd34
commit 388b39b511
3 changed files with 13 additions and 9 deletions

View file

@ -16,9 +16,12 @@ public class BroomSweeping : MonoBehaviour
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if (!other.CompareTag("Dirt")) return; if (!other.CompareTag("Dirt"))
{
// Add to dirt swept count
dirtSweeped++; dirtSweeped++;
// Destroy it to prevent extra counting
Destroy(other.gameObject); Destroy(other.gameObject);
// Play sound only if no other sound is currently playing // Play sound only if no other sound is currently playing
@ -28,3 +31,4 @@ public class BroomSweeping : MonoBehaviour
} }
} }
} }
}

View file

@ -9,7 +9,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public class Sweeping : MonoBehaviour public class SweepingTask : MonoBehaviour
{ {
public Transform broomParent; // Assign the parent object of the broom public Transform broomParent; // Assign the parent object of the broom
public float sweepSpeed = 2f; // Speed of automatic sweeping public float sweepSpeed = 2f; // Speed of automatic sweeping