Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Level11Jessey
- {
- public class SpawnDestroyer : MonoBehaviour
- {
- [SerializeField] private IDamageableObject m_DamageblePart;
- private void Start()
- {
- if (m_DamageblePart != null)
- {
- m_DamageblePart.DamageEvent += OnDamage;
- m_DamageblePart.DeathEvent += OnDeath;
- }
- }
- private void OnDestroy()
- {
- if (m_DamageblePart == null)
- return;
- m_DamageblePart.DamageEvent -= OnDamage;
- m_DamageblePart.DeathEvent -= OnDeath;
- }
- private void OnDamage(int removedHealth) { }
- private void OnDeath()
- {
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement