UI and enemy movement

This commit is contained in:
2023-07-11 23:07:03 +03:00
parent aa5e5586b2
commit 14a6a06159
81 changed files with 13839 additions and 55 deletions
+12
View File
@@ -1,5 +1,9 @@
using System;
using UnityEngine;
public class Player : Character
{
[SerializeField]
@@ -18,6 +22,9 @@ public class Player : Character
private int _totalCoins = 0;
private bool _hasKey = false;
public int TotalCoins => _totalCoins;
public static Player Instance { get; private set; }
private GameObject _hammer;
@@ -25,6 +32,8 @@ public class Player : Character
private bool _isHoldingHammer = true;
private SpriteRenderer _spriteRenderer;
public event EventHandler<TreasureType> OnPlayerTakeItem;
private void Awake()
{
if (Instance != null)
@@ -44,11 +53,13 @@ public class Player : Character
public void AddCoin()
{
_totalCoins++;
OnPlayerTakeItem?.Invoke(this,TreasureType.Coin);
print($"player have {_totalCoins} coins");
}
public void SetKey()
{
OnPlayerTakeItem?.Invoke(this, TreasureType.Key);
print($"player have key");
_hasKey = true;
}
@@ -121,3 +132,4 @@ public class Player : Character
}
}