✨ updated PlayerInteraction
This commit is contained in:
parent
65fe1823ec
commit
9f48b79907
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user