无人机定位
This commit is contained in:
parent
3aafd10937
commit
f2b7476009
|
@ -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.009410857, g: 0.009313087, b: 0.009679941, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
|
@ -6649,6 +6649,7 @@ MonoBehaviour:
|
|||
modelname_text: {fileID: 0}
|
||||
isDragWRJ: 1
|
||||
deviceID:
|
||||
isPlayer: 0
|
||||
--- !u!1 &147647007
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -48267,6 +48268,7 @@ GameObject:
|
|||
- component: {fileID: 1436809533}
|
||||
- component: {fileID: 1436809529}
|
||||
- component: {fileID: 1436809534}
|
||||
- component: {fileID: 1436809535}
|
||||
m_Layer: 0
|
||||
m_Name: Bootstraps
|
||||
m_TagString: Untagged
|
||||
|
@ -48399,6 +48401,18 @@ MonoBehaviour:
|
|||
deviceimages1: []
|
||||
deviceimages: []
|
||||
modellist: []
|
||||
--- !u!114 &1436809535
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1436809528}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 27096289766e99845a47ad87729a988f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1444599844
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -61848,10 +61862,10 @@ MonoBehaviour:
|
|||
colorSkyBase: {r: 0.6054902, g: 0.7090196, b: 0.7968628, a: 0.8}
|
||||
colorSkyBaseLow: {r: 0.75686276, g: 0.88627446, b: 0.9960785, a: 1}
|
||||
colorHorizon: {r: 0.9082354, g: 1.0682354, b: 1.1952941, a: 1.2}
|
||||
colorHorizonLow: {r: 0.9082354, g: 1.0682354, b: 1.1952941, a: 1.2}
|
||||
colorHorizonLow: {r: 0.12235295, g: 0.2964706, b: 0.36705884, a: 1.2}
|
||||
colorSkyAmbient: {r: 1, g: 1, b: 1, a: 1}
|
||||
colorClouds: {r: 1, g: 1, b: 1, a: 1}
|
||||
colorHighlightClouds: {r: 1, g: 1, b: 1, a: 1}
|
||||
colorHighlightClouds: {r: 0, g: 0, b: 0, a: 1}
|
||||
colorSkyboxGround: {r: 0.1102941, g: 0.08836951, b: 0.06487888, a: 1}
|
||||
colorSkyboxMie: {r: 1, g: 1, b: 1, a: 1}
|
||||
displayTime: '[ 10:30:00 AM] [ 3/6/1027 ad]'
|
||||
|
@ -62189,7 +62203,7 @@ MonoBehaviour:
|
|||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
randSeed: 122322625
|
||||
randSeed: 830968
|
||||
isDoingTransition: 0
|
||||
minimumHeight: 0
|
||||
--- !u!114 &1820978574
|
||||
|
|
|
@ -5,7 +5,10 @@ using UnityEngine;
|
|||
|
||||
public class DeviceManager : MonoBehaviour
|
||||
{
|
||||
public List<DeviceInfoItem> devices = new List<DeviceInfoItem>();
|
||||
/// <summary>
|
||||
/// 所有设备
|
||||
/// </summary>
|
||||
public static List<EquipmentCommon> devices = new List<EquipmentCommon>();
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
@ -13,7 +16,7 @@ public class DeviceManager : MonoBehaviour
|
|||
}
|
||||
|
||||
|
||||
public void AddDevice(DeviceInfoItem d)
|
||||
public void AddDevice(EquipmentCommon d)
|
||||
{
|
||||
if (!devices.Contains(d))
|
||||
{
|
||||
|
@ -24,13 +27,10 @@ public class DeviceManager : MonoBehaviour
|
|||
public void GetSend2roomMsg(string data)
|
||||
{
|
||||
string[] info = data.Split(',');
|
||||
for (int i = 0; i < devices.Count; i++)
|
||||
EquipmentCommon equipmentCommon = devices.Find(x => x.deviceID == info[1]);
|
||||
if (equipmentCommon)
|
||||
{
|
||||
if (devices[i].deviceId == info[0])
|
||||
{
|
||||
devices[i].Refesh(info);
|
||||
}
|
||||
|
||||
equipmentCommon.ReceivingPositionAngle(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,12 +178,7 @@ public class GameManager : MonoBehaviour
|
|||
break;
|
||||
case "offline":
|
||||
break;
|
||||
case "WRJPosAngle":
|
||||
EquipmentCommon equipmentCommon = EquipmentCommon.equipmentCommons.Find(x => x.deviceID == data[1]);
|
||||
if (equipmentCommon)
|
||||
{
|
||||
equipmentCommon.ReceivingPositionAngle(data);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -16,10 +16,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
/// 场景所在方
|
||||
/// </summary>
|
||||
public SelectedSide selectedSide = SelectedSide.Other;
|
||||
/// <summary>
|
||||
/// 所有设备
|
||||
/// </summary>
|
||||
public static List<EquipmentCommon> equipmentCommons = new List<EquipmentCommon>();
|
||||
|
||||
public string equipmentType = "";
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,7 +64,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
void Start()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
equipmentCommons.Add(this);
|
||||
DeviceManager.devices.Add(this);
|
||||
// 订阅布尔值变化事件
|
||||
OnActivationChanged += OnActivationChangedHandler;
|
||||
//
|
||||
|
@ -179,19 +176,15 @@ public class EquipmentCommon : MonoBehaviour
|
|||
{
|
||||
latestData = nowData;
|
||||
Debug.Log(latestData);
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}",nowData));
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string GetSyncData()
|
||||
{
|
||||
return string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", "WRJPosAngle", equipmentCommon.deviceID, transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
|
||||
return string.Format("{0},{1},{2},{3},{4},{5},{6}", equipmentCommon.deviceID, transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
|
||||
}
|
||||
|
||||
public void GetDeviceInfo(string info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
|
@ -208,8 +201,9 @@ public class EquipmentCommon : MonoBehaviour
|
|||
/// <param name="data"></param>
|
||||
public void ReceivingPositionAngle(string[] data)
|
||||
{
|
||||
Vector3 pos = new Vector3(float.Parse(data[2]), float.Parse(data[3]), float.Parse(data[4]));
|
||||
Vector3 rot = new Vector3(float.Parse(data[4]), float.Parse(data[6]), float.Parse(data[7]));
|
||||
Debug.Log(data[0]);
|
||||
Vector3 pos = new Vector3(float.Parse(data[1]), float.Parse(data[2]), float.Parse(data[3]));
|
||||
Vector3 rot = new Vector3(float.Parse(data[4]), float.Parse(data[5]), float.Parse(data[6]));
|
||||
transform.position = pos;
|
||||
transform.position = rot;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue