33 lines
893 B
C#
33 lines
893 B
C#
using System;
|
|
using UnityEngine;
|
|
using Random = UnityEngine.Random;
|
|
|
|
public class BushInteraction : MonoBehaviour
|
|
{
|
|
private int blueberryCount = 0;
|
|
private bool BlueBerriesPicked = false;
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
blueberryCount = Random.Range(1, 5); // Randomly initialize blueberry count between 1 and 5
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
void OnTriggerEnter(Collider other)
|
|
{
|
|
// increase blueberry count in the StateManager
|
|
if (!BlueBerriesPicked)
|
|
{
|
|
other.gameObject.GetComponent<PlayerInteraction>().CollectBlueberry(blueberryCount);
|
|
BlueBerriesPicked = true;
|
|
}
|
|
//TODO: switch to different bush model, so that the player can see that the bush is empty
|
|
|
|
}
|
|
}
|