Files
ProjectMD/Assets/Scripts/GameBase/Gate.cs

18 lines
393 B
C#

using UnityEngine;
using System;
// Gate.cs
public class Gate : MonoBehaviour, IDamageable
{
[SerializeField] private float maxHealth = 50f;
private float _currentHealth;
void Awake() => _currentHealth = maxHealth;
public void TakeDamage(float amount)
{
_currentHealth -= amount;
if (_currentHealth <= 0)
gameObject.SetActive(false);
}
}