This commit is contained in:
YangHua 2023-11-22 09:19:09 +08:00
parent f2b7476009
commit 978b70d201
3 changed files with 12 additions and 11 deletions

View File

@ -3,12 +3,12 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeviceManager : MonoBehaviour
public class DeviceManager : MonoSingleton<DeviceManager>
{
/// <summary>
/// 所有设备
/// </summary>
public static List<EquipmentCommon> devices = new List<EquipmentCommon>();
public List<EquipmentCommon> devices = new List<EquipmentCommon>();
// Start is called before the first frame update
void Start()
{

View File

@ -93,6 +93,7 @@ public class GameManager : MonoBehaviour
tenkokuModule.mainCamera = spt.transform;
}
public void Start()
{
SetWeatherValue();

View File

@ -64,7 +64,7 @@ public class EquipmentCommon : MonoBehaviour
void Start()
{
equipmentCommon = GetComponent<EquipmentCommon>();
DeviceManager.devices.Add(this);
DeviceManager.Instance.devices.Add(this);
// 订阅布尔值变化事件
OnActivationChanged += OnActivationChangedHandler;
//
@ -72,7 +72,7 @@ public class EquipmentCommon : MonoBehaviour
}
void OnActivationChangedIsPlayer(bool newValue)
{
if(newValue&& equipmentType== "无人机List"&& isOnlyOne)
if (newValue && equipmentType == "无人机List" && isOnlyOne)
{
isOnlyOne = false;
StartCoroutine(SendMsg());
@ -119,7 +119,7 @@ public class EquipmentCommon : MonoBehaviour
public void FillInTheData(List<List_paraItem> weaponitemone)
{
//向其他的单位发送创建信息
if (isPlayer&& equipmentCommon)//但是是由我自主创建的时候发送一次 且只发送一次
if (isPlayer && equipmentCommon)//但是是由我自主创建的时候发送一次 且只发送一次
{
string paraListJson = JsonConvert.SerializeObject(weaponitemone);
replaceInfoDic.Add("PracticeId", GlobalFlag.roomID);