This commit is contained in:
Crizomb 2025-01-20 21:05:28 +01:00
parent ffb1f1caa1
commit b21d392ff6
80 changed files with 2888 additions and 221 deletions

View file

@ -0,0 +1,29 @@
using System.Collections;
using UnityEngine;
public class CreeperBomb : AttackHandler
{
[SerializeField] private GameObject explodeMesh;
[SerializeField] private float exploseMeshTime = 0.5f;
public override bool Attack()
{
bool hasExploded = base.Attack();
if (hasExploded)
{
_minecraftUnit.HealthHandler.Death();
CoroutineManager.Instance.StartCoroutine(ExplodeVisual());
Destroy(gameObject);
}
return hasExploded;
}
private IEnumerator ExplodeVisual()
{
GameObject explosion = Instantiate(explodeMesh, transform.position, Quaternion.identity);
explosion.transform.parent = null;
yield return new WaitForSeconds(exploseMeshTime);
Destroy(explosion);
}
}