things
This commit is contained in:
parent
a17810ffeb
commit
4e91f448c9
826 changed files with 66 additions and 8 deletions
29
Assets/Scripts/UnitScripts/Attacks/CreeperBomb.cs
Normal file
29
Assets/Scripts/UnitScripts/Attacks/CreeperBomb.cs
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue