Files
GameDevTVRocketBoost/Assets/Scripts/ObjectStats.cs

28 lines
557 B
C#
Raw Normal View History

2026-01-09 17:21:32 +00:00
using UnityEngine;
public class ObjectStats : MonoBehaviour
{
float curHealth = 100;
[SerializeField] float maxHealth = 100;
public float damage = 25f;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
curHealth = maxHealth;
}
// Update is called once per frame
void Update()
{
}
public void TakeDamage()
{
curHealth -= damage;
if (curHealth <= 0)
{
Destroy(gameObject);
}
}
}