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) void OnTriggerEnter(Collider other)
{ {
if (!BlueBerriesPicked && other.CompareTag("Player")) if (!BlueBerriesPicked)
{ {
if (emptyBush == null) if (emptyBush == null)
{ {
PlayBushesEvent.Post(gameObject); PlayBushesEvent.Post(gameObject);
return; return;
} }
// Play the "Play_BerryWithBush" event if bush has berries if (other.CompareTag("Player"))
PlayBerryWithBushEvent.Post(gameObject); {
// Play the "Play_BerryWithBush" event if bush has berries
PlayBerryWithBushEvent.Post(gameObject);
other.gameObject.GetComponent<PlayerInteraction>().CollectBlueberry(blueberryCount); other.gameObject.GetComponent<PlayerInteraction>().CollectBlueberry(blueberryCount);
ChangeBushAppearance(); ChangeBushAppearance();
blueberryCount = 0; blueberryCount = 0;
BlueBerriesPicked = true; BlueBerriesPicked = true;
}
} }
} }

View File

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