From 9f48b79907e0337061a85c68605037fccd1f4700 Mon Sep 17 00:00:00 2001 From: AgentSchmisch Date: Wed, 18 Jun 2025 09:11:23 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20updated=20PlayerInteraction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scripts/BushInteraction.cs | 18 +++++++++++------- .../Assets/Scripts/PlayerInteraction.cs | 9 +++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/blueberryPeak/Assets/Scripts/BushInteraction.cs b/blueberryPeak/Assets/Scripts/BushInteraction.cs index 97d56ee..b77df85 100644 --- a/blueberryPeak/Assets/Scripts/BushInteraction.cs +++ b/blueberryPeak/Assets/Scripts/BushInteraction.cs @@ -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().CollectBlueberry(blueberryCount); - ChangeBushAppearance(); - blueberryCount = 0; - BlueBerriesPicked = true; + other.gameObject.GetComponent().CollectBlueberry(blueberryCount); + ChangeBushAppearance(); + blueberryCount = 0; + BlueBerriesPicked = true; + } } } diff --git a/blueberryPeak/Assets/Scripts/PlayerInteraction.cs b/blueberryPeak/Assets/Scripts/PlayerInteraction.cs index 35805ed..757fcd3 100644 --- a/blueberryPeak/Assets/Scripts/PlayerInteraction.cs +++ b/blueberryPeak/Assets/Scripts/PlayerInteraction.cs @@ -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 items) + { + inventory = items; + } }