Kursach_StealthAction/Assets/Scripts/PlayerHealth.cs
2026-10-11 19:16:11 +03:00

21 lines
627 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
public class PlayerHealth : MonoBehaviour
{
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("ИГРОК МЕРТВ! Конец игры.");
// Здесь позже можно будет добавить перезагрузку уровня
}
}
}