JamesMakesGames

ExplosiveBarrel

Feb 24th, 2022
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class ExplosiveBarrel : MonoBehaviour, IDamageable
  4. {
  5.     [SerializeField] private GameObject explosionEffect;
  6.  
  7.     public void Explode()
  8.     {
  9.         Instantiate(explosionEffect, transform.position, Quaternion.identity);
  10.         Destroy(gameObject);
  11.     }
  12.  
  13.     public void Damage(float damageAmount)
  14.     {
  15.         Explode();
  16.     }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment