diff --git a/Assets/Temp/Scripts/Mastermanagement.cs b/Assets/Temp/Scripts/Mastermanagement.cs index e0b0e624..c41a827d 100644 --- a/Assets/Temp/Scripts/Mastermanagement.cs +++ b/Assets/Temp/Scripts/Mastermanagement.cs @@ -5,7 +5,7 @@ using UnityEngine; public class Mastermanagement : MonoBehaviour { - + public List dragControllers = new List();//蓝方设备用于存UI元素 public List weapongames = new List();//蓝方设备用于存储场景中的物体 void Awake() @@ -62,7 +62,7 @@ public class Mastermanagement : MonoBehaviour { for (int i = 0; i < dragControllers.Count; i++) { - if (dragControllers[i].gameObject.name == game.name&& !dragControllers[i].gameObject.activeSelf) + if (dragControllers[i].gameObject.name == game.name && !dragControllers[i].gameObject.activeSelf) { dragControllers[i].gameObject.SetActive(true); break; @@ -83,7 +83,7 @@ public class Mastermanagement : MonoBehaviour if (weapongames.Contains(obj)) { weapongames.Remove(obj); - DeviceManager.Instance.devices.Remove(obj.GetComponent()); + DeviceManager.Instance.RemoveDevice(obj); Destroy(obj); } } diff --git a/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity b/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity index eaa54c17..5fae3d49 100644 --- a/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity +++ b/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1113159741} - m_IndirectSpecularColor: {r: 0.030100383, g: 0.03369107, b: 0.03534769, a: 1} + m_IndirectSpecularColor: {r: 0.16234362, g: 0.306482, b: 0.6709422, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -37848,7 +37848,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &754191142 RectTransform: m_ObjectHideFlags: 0 @@ -49516,6 +49516,8 @@ MonoBehaviour: - {fileID: 745447508} - {fileID: 1213021907} mastermanagement: {fileID: 147647013} + postureBtn: {fileID: 1594140421} + teacherBtn: {fileID: 1565322412} --- !u!4 &1436809530 Transform: m_ObjectHideFlags: 0 @@ -59992,29 +59994,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1565322413} m_OnClick: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1719983405} - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 1 - m_CallState: 2 - - m_Target: {fileID: 754191141} - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] --- !u!114 &1565322413 MonoBehaviour: m_ObjectHideFlags: 0 @@ -60795,29 +60775,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1594140422} m_OnClick: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 754191141} - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 1 - m_CallState: 2 - - m_Target: {fileID: 1719983405} - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] --- !u!114 &1594140422 MonoBehaviour: m_ObjectHideFlags: 0 @@ -63964,7 +63922,7 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - randSeed: 3823234 + randSeed: 683195703 isDoingTransition: 0 minimumHeight: 0 --- !u!114 &1820978574 @@ -70892,7 +70850,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u8FDB\u5165\u6001\u52BF" + m_Text: "\u8FDB\u5165\u5BFC\u8C03" --- !u!222 &1972282669 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Zion/Scripts/Adam/Components/PostureController.cs b/Assets/Zion/Scripts/Adam/Components/PostureController.cs new file mode 100644 index 00000000..91acd98c --- /dev/null +++ b/Assets/Zion/Scripts/Adam/Components/PostureController.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PostureController : MonoBehaviour +{ + public List redObjs = new List(); + public List blueObjs = new List(); + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + private void OnEnable() + { + + } + + private void GetSceneInfo() + { + + } +} diff --git a/Assets/Zion/Scripts/Adam/Components/PostureController.cs.meta b/Assets/Zion/Scripts/Adam/Components/PostureController.cs.meta new file mode 100644 index 00000000..d3e7af7f --- /dev/null +++ b/Assets/Zion/Scripts/Adam/Components/PostureController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 16abbb3ac7fac0b4a85fa24a4ceefd26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 9d2017f6..3a6208ba 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -41,7 +41,7 @@ public class DeviceManager : MonoSingleton void Start() { - + } @@ -92,6 +92,12 @@ public class DeviceManager : MonoSingleton } } + public void RemoveDevice(GameObject obj) + { + if (devices.Contains(obj.GetComponent())) + devices.Remove(obj.GetComponent()); + } + public int GetPlayerDevice() { List temp = new List(); diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index f69a4191..821092e3 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using Tenkoku.Core; using UnityEngine; +using UnityEngine.UI; using static InterfaceManager; public class GameManager : MonoSingleton @@ -37,9 +38,20 @@ public class GameManager : MonoSingleton public Mastermanagement mastermanagement; - // Start is called before the first frame update + public Button postureBtn; + public Button teacherBtn; + + // Start is called before the first frame update private void Awake() { + postureBtn.onClick.AddListener(() => + { + ChangeView(0); + }); + teacherBtn.onClick.AddListener(() => + { + ChangeView(2); + }); SyncCreateRoom.getroomusersRequset += OnGetRoomUsers; SyncCreateRoom.send2roomRequset += OnRoomInfo; SyncPlayerTransform spt = Instantiate(playerTransformPrefab); @@ -60,7 +72,7 @@ public class GameManager : MonoSingleton wrjCount = diTemp.device_count; for (int i = 0; i < wrjDrags.Length; i++) { - wrjDrags[i].isPlayer = true; + wrjDrags[i].isPlayer = true; wrjDrags[i].deviceID = UIBootstrap.Instance.GetDeviceByName("蜂群无人机").id; } } @@ -187,6 +199,17 @@ public class GameManager : MonoSingleton } } + /// + /// 切换视图 + /// + /// + public void ChangeView(int index) + { + Teacher.gameObject.SetActive(index == 0); + student.gameObject.SetActive(index == 1); + posture.gameObject.SetActive(index == 2); + } + public void AddPlayers(SyncPlayerTransform s) { if (!players.Contains(s)) @@ -369,16 +392,22 @@ public class GameManager : MonoSingleton device.transform.position = new Vector3(float.Parse(tran[1]), float.Parse(tran[2]), float.Parse(tran[3])); device.transform.eulerAngles = new Vector3(float.Parse(tran[4]), float.Parse(tran[5]), float.Parse(tran[6])); } + else + { + string[] deviceTran = data.r1.Split(','); - string[] deviceTran = data.r1.Split(','); - - device.transform.position = new Vector3(float.Parse(deviceTran[0]), float.Parse(deviceTran[1]), float.Parse(deviceTran[2])); - device.transform.eulerAngles = new Vector3(float.Parse(deviceTran[3]), float.Parse(deviceTran[4]), float.Parse(deviceTran[5])); + device.transform.position = new Vector3(float.Parse(deviceTran[0]), float.Parse(deviceTran[1]), float.Parse(deviceTran[2])); + device.transform.eulerAngles = new Vector3(float.Parse(deviceTran[3]), float.Parse(deviceTran[4]), float.Parse(deviceTran[5])); + } if (!string.IsNullOrEmpty(data.r2) || data.r2 != "") { int wrjModelCount = int.Parse(data.r2); - if (device.GetComponent()) - device.GetComponent().wrjModel = (WRJModel)wrjModelCount; + UnmannedAerialVehicleManage uavm = device.GetComponent(); + if (uavm) + { + uavm.wrjModel = (WRJModel)wrjModelCount; + device.name = uavm.wrjModel.ToString(); + } } Debug.Log($"是否是player{data.r3 == GlobalFlag.currentUser.user_id}"); diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs index 7b4bc3a7..bc58e69d 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs @@ -127,7 +127,7 @@ public class UnmannedAerialVehicle : MonoBehaviour Bao.transform.localPosition = Vector3.zero; Bao.transform.SetParent(null); Bao.SetActive(true); - + DeviceManager.Instance.RemoveDevice(gameObject); Destroy(gameObject); } @@ -159,7 +159,7 @@ public class UnmannedAerialVehicle : MonoBehaviour } //重点打击目标 HighPriorityTarget highPriorityTarget = _transform.GetComponent(); - if (highPriorityTarget ) + if (highPriorityTarget) { highPriorityTarget.BeAssaulted(atkPos, true); } @@ -169,7 +169,10 @@ public class UnmannedAerialVehicle : MonoBehaviour Bao.transform.SetParent(null); Bao.SetActive(true); if (_equipmentCommon) + { + DeviceManager.Instance.RemoveDevice(_transform.gameObject); Destroy(_transform.gameObject); + } } /// ///上传日志 @@ -285,8 +288,9 @@ public class UnmannedAerialVehicle : MonoBehaviour yield return new WaitForSeconds(5f); GameObject obj = Instantiate(bulletPrefab, bulletPoint.position, bulletPoint.rotation); obj.SetActive(true); - - obj.transform.DOMove(v3, 2).SetEase(Ease.Linear).OnComplete(() => { + + obj.transform.DOMove(v3, 2).SetEase(Ease.Linear).OnComplete(() => + { Destroy(obj); }); ShellBoom sb = obj.AddComponent();