This commit is contained in:
YangHua 2024-03-28 17:40:58 +08:00
parent 368393efa2
commit 8f2d9ce319
4 changed files with 15 additions and 8 deletions

View File

@ -13,6 +13,11 @@ public class DeviceManager : MonoSingleton<DeviceManager>
/// </summary>
//public Queue<string> send2roomStr = new Queue<string>();
/// <summary>
/// 爆炸预制体
/// </summary>
public GameObject explodePrefab;
private bool _isStartRehearsing = false;
// 属性绑定布尔值,并在值变化时触发事件
public bool isStartRehearsing
@ -42,7 +47,7 @@ public class DeviceManager : MonoSingleton<DeviceManager>
void Start()
{
explodePrefab = Resources.Load<GameObject>("SmallExplosionEffect");
}
@ -86,6 +91,14 @@ public class DeviceManager : MonoSingleton<DeviceManager>
public void RemoveDevice(GameObject obj)
{
if (explodePrefab /*&& transform*/)
{
GameObject Bao = Instantiate(explodePrefab, obj.transform);
Bao.transform.localPosition = Vector3.zero;
Bao.transform.SetParent(null);
Bao.SetActive(true);
}
if (devices.Contains(obj.GetComponent<EquipmentCommon>()))
devices.Remove(obj.GetComponent<EquipmentCommon>());
}

View File

@ -128,13 +128,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
+ "编号" + serialNumber + "子无人机" + "自杀式攻击自爆了";
UploadLog(_log);
}
if (explodePrefab /*&& transform*/)
{
GameObject Bao = Instantiate(explodePrefab, transform);
Bao.transform.localPosition = Vector3.zero;
Bao.transform.SetParent(null);
Bao.SetActive(true);
}
//DroneViewDisplay.Instance.DistroyUI(unmannedAerialVehicleManage.equipmentCommon.deviceID);
DeviceManager.Instance.RemoveDevice(gameObject);
Destroy(gameObject);