Files
real-shooter/Assets/Scripts/Weapons/Target.cs
2022-05-09 22:43:31 +07:00

25 lines
395 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Target : MonoBehaviour
{
public float health = 50f;
public void TakeDamage(float amount)
{
health -= amount;
if (health <= 0f)
{
Die();
}
}
void Die()
{
Destroy(gameObject);
gameObject.SetActive(false);
}
}