updated PlayerInteraction

This commit is contained in:
AgentSchmisch 2025-06-18 09:11:23 +02:00
parent 65fe1823ec
commit 9f48b79907
2 changed files with 20 additions and 7 deletions

View File

@ -34,20 +34,24 @@ public class BushInteraction : MonoBehaviour
void OnTriggerEnter(Collider other)
{
if (!BlueBerriesPicked && other.CompareTag("Player"))
if (!BlueBerriesPicked)
{
if (emptyBush == null)
{
PlayBushesEvent.Post(gameObject);
return;
}
// Play the "Play_BerryWithBush" event if bush has berries
PlayBerryWithBushEvent.Post(gameObject);
if (other.CompareTag("Player"))
{
// Play the "Play_BerryWithBush" event if bush has berries
PlayBerryWithBushEvent.Post(gameObject);
other.gameObject.GetComponent<PlayerInteraction>().CollectBlueberry(blueberryCount);
ChangeBushAppearance();
blueberryCount = 0;
BlueBerriesPicked = true;
other.gameObject.GetComponent<PlayerInteraction>().CollectBlueberry(blueberryCount);
ChangeBushAppearance();
blueberryCount = 0;
BlueBerriesPicked = true;
}
}
}

View File

@ -90,6 +90,10 @@ public class PlayerInteraction : MonoBehaviour
{
return blueberryCount;
}
public void SetBlueberryCount(int count)
{
blueberryCount = count;
}
public void CollectBlueberry(int newBlueberries)
{
@ -127,4 +131,9 @@ public class PlayerInteraction : MonoBehaviour
{
return inventory;
}
public void SetInventoryItems(List<InventoryItem> items)
{
inventory = items;
}
}