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)
{
if (!other.CompareTag("Dirt")) return;
if (!other.CompareTag("Dirt"))
{
// Add to dirt swept count
dirtSweeped++;
// Destroy it to prevent extra counting
Destroy(other.gameObject);
// Play sound only if no other sound is currently playing
@ -27,4 +30,5 @@ public class BroomSweeping : MonoBehaviour
audioSource.PlayOneShot(sweepingSound);
}
}
}
}

View file

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