25 lines
410 B
C#
25 lines
410 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Target : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
|
|
public float health = 50f;
|
|
|
|
public void TakeDamage(float amount)
|
|
{
|
|
health -= amount;
|
|
if (health <= 0f)
|
|
{
|
|
Die();
|
|
}
|
|
}
|
|
|
|
void Die()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|