Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class GWEnemy : MonoBehaviour
- {
- [SerializeField] private int _maxHealth;
- private int _currentHealth;
- private void Start()
- {
- _currentHealth = _maxHealth;
- }
- public void TakeDamage(int damage)
- {
- _currentHealth -= damage;
- if(_currentHealth <= 0)
- {
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement