UI and enemy movement
This commit is contained in:
@@ -8,6 +8,8 @@ public class Chest : MonoBehaviour
|
||||
private TreasureSO _treasureSO;
|
||||
|
||||
private Transform _treasureObject;
|
||||
private bool _isOpen=false;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -20,8 +22,9 @@ public class Chest : MonoBehaviour
|
||||
private void OnTriggerEnter2D(Collider2D collider)
|
||||
{
|
||||
var player=collider.GetComponent<Player>();
|
||||
if (player != null)
|
||||
if (player != null && !_isOpen)
|
||||
{
|
||||
_isOpen = true;
|
||||
animator.SetTrigger("OpenChest");
|
||||
switch (_treasureSO.Treasure)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user