using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class BasketForLab : MonoBehaviour
{
public GameObject[] labVeggies;
public GameObject[] naturalVeggies;
public bool taskMessedUp;
public AudioSource taskWrongSound;
public bool labPotato;
public bool labCarrot;
public bool labBeetroot;
public bool labTaskCompleted;
private void Update()
{
// Check if all correct veggies are delivered
if (labPotato && labCarrot && labBeetroot)
{
labTaskCompleted = true;
// Reset for future use if needed
labPotato = false;
labCarrot = false;
labBeetroot = false;
}
}
private void OnTriggerEnter(Collider collision)
{
// Check if the entered veggie is one of the lab veggies
foreach (GameObject veggie in labVeggies)
{
if (collision.gameObject == veggie)
{
if (veggie == labVeggies[0]) labPotato = true;
if (veggie == labVeggies[1]) labCarrot = true;
if (veggie == labVeggies[2]) labBeetroot = true;
}
}
// Check for incorrect veggies
foreach (GameObject nVeggie in naturalVeggies)
{
if (collision.gameObject == nVeggie)
{
Debug.Log("ALARM TRIGGERED");
taskMessedUp = true;
if (!taskWrongSound.isPlaying)
{
taskWrongSound.Play();
}
}
}
}
}