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; + } }