Files
MRCS/Assets/_MrCs/Scripts/Explosions/ShieldExplosion.cs
2025-11-10 18:46:16 +08:00

53 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using DamageNumbersPro;
using DragonLi.Frame;
using UnityEngine;
public class ShieldExplosion : Explosion,IDamagable
{
public int hp;
public GameObject[] models;
public override void OnSpawn(float curDurationTime)
{
base.OnSpawn(curDurationTime);
GunInfo info = GameManager.Ins.GunInfos[(GunType)type][1];
hp=info.Hp;
foreach (var model in models)
{
var shieldModel = model.GetComponent<DamageBox>();
if (shieldModel != null)
{
shieldModel.Health = hp;
}
model.SetActive(false);
}
StartCoroutine(ShowModels());
}
IEnumerator ShowModels()
{
models[0].SetActive(true);
models[1].SetActive(true);
models[2].SetActive(true);
yield return new WaitForSeconds(0.5f);
models[3].SetActive(true);
models[4].SetActive(true);
models[5].SetActive(true);
yield return new WaitForSeconds(0.5f);
models[6].SetActive(true);
models[7].SetActive(true);
models[8].SetActive(true);
}
public void ApplyDamage(float value, object info, Transform _sender)
{
DamageNumber prefab = MRDamage.Ins.GetCurrent();
DamageNumber newDamageNumber = prefab.Spawn(_sender.position, value);
}
public float Health { get; set; }
}