то же самое
This commit is contained in:
1 parent
090cdc9933
commit
ac99977be3
534 files changed
+36990
-48
No files matched your search
@@ -1,7 +1,21 @@
|
||||
namespace DefaultNamespace
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerHealth : MonoBehaviour
|
||||
{
|
||||
public class PlayerHealth
|
||||
public float maxHealth = 100f;
|
||||
private float currentHealth;
|
||||
|
||||
void Start() { currentHealth = maxHealth; }
|
||||
|
||||
public void TakeDamage(float damage)
|
||||
{
|
||||
currentHealth -= damage;
|
||||
Debug.Log("Игрок получил урон! Осталось здоровья: " + currentHealth);
|
||||
|
||||
if (currentHealth <= 0)
|
||||
{
|
||||
Debug.Log("ИГРОК МЕРТВ! Конец игры.");
|
||||
// Здесь позже можно будет добавить перезагрузку уровня
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user