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

21 lines
565 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 MutantHealth : MonoBehaviour
{
public float maxHealth = 50f;
private float currentHealth;
void Start() { currentHealth = maxHealth; }
public void TakeDamage(float damage)
{
currentHealth -= damage;
Debug.Log("Мутант получил урон! Осталось: " + currentHealth);
if (currentHealth <= 0)
{
Debug.Log("МУТАНТ УМЕР!");
Destroy(gameObject); // Уничтожаем модельку мутанта
}
}
}