Files
Kursach_StealthAction/Assets/Scripts/MutantHealth.cs
T

21 lines
565 B
C#
Raw Normal View History

2026-10-11 19:16:11 +03:00
using UnityEngine;
public class MutantHealth : MonoBehaviour
2026-10-11 19:15:15 +03:00
{
2026-10-11 19:16:11 +03:00
public float maxHealth = 50f;
private float currentHealth;
void Start() { currentHealth = maxHealth; }
public void TakeDamage(float damage)
2026-10-11 19:15:15 +03:00
{
2026-10-11 19:16:11 +03:00
currentHealth -= damage;
Debug.Log("Мутант получил урон! Осталось: " + currentHealth);
2026-10-11 19:15:15 +03:00
2026-10-11 19:16:11 +03:00
if (currentHealth <= 0)
{
Debug.Log("МУТАНТ УМЕР!");
Destroy(gameObject); // Уничтожаем модельку мутанта
}
2026-10-11 19:15:15 +03:00
}
}