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

View File

@ -128,13 +128,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
+ "编号" + serialNumber + "子无人机" + "自杀式攻击自爆了"; + "编号" + serialNumber + "子无人机" + "自杀式攻击自爆了";
UploadLog(_log); 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); //DroneViewDisplay.Instance.DistroyUI(unmannedAerialVehicleManage.equipmentCommon.deviceID);
DeviceManager.Instance.RemoveDevice(gameObject); DeviceManager.Instance.RemoveDevice(gameObject);
Destroy(gameObject); Destroy(gameObject);