添加编组功能
This commit is contained in:
parent
962bcc3205
commit
20b0b3e0db
|
@ -32,8 +32,8 @@ Material:
|
||||||
- _dispStrength: 1
|
- _dispStrength: 1
|
||||||
- _overBright: 1
|
- _overBright: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _AmbientTint: {r: 1, g: 1, b: 1, a: 1}
|
- _AmbientTint: {r: 0, g: 0, b: 0, a: 1}
|
||||||
- _Color: {r: 0.5, g: 0.49803922, b: 0.49215686, a: 0.2}
|
- _Color: {r: 0.25, g: 0.25, b: 0.25, a: 0.040000003}
|
||||||
- _GlowColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
- _GlowColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
||||||
- _PrimaryTint: {r: 1, g: 1, b: 1, a: 1}
|
- _PrimaryTint: {r: 1, g: 1, b: 1, a: 1}
|
||||||
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
|
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
|
|
@ -38,7 +38,7 @@ RenderSettings:
|
||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 1113159741}
|
m_Sun: {fileID: 1113159741}
|
||||||
m_IndirectSpecularColor: {r: 0.12549877, g: 0.1459642, b: 0.15314084, a: 1}
|
m_IndirectSpecularColor: {r: 0.06491052, g: 0.12166043, b: 0.26573104, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
|
@ -54458,10 +54458,11 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
startFormationBtn: {fileID: 535597723}
|
startFormationBtn: {fileID: 535597723}
|
||||||
submitFormationBtn: {fileID: 1724214693}
|
submitFormationBtn: {fileID: 1724214693}
|
||||||
|
cancelFormationBtn: {fileID: 1912788541}
|
||||||
isStartFormation: 0
|
isStartFormation: 0
|
||||||
formationInfos: []
|
formationInfos: []
|
||||||
formationInfo:
|
formationInfo:
|
||||||
groupName:
|
groupName: 0
|
||||||
uavms: []
|
uavms: []
|
||||||
--- !u!1 &1444599844
|
--- !u!1 &1444599844
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -65870,7 +65871,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 363.8, y: -90.7}
|
m_AnchoredPosition: {x: 363.7998, y: -90.700195}
|
||||||
m_SizeDelta: {x: 0, y: 45.75061}
|
m_SizeDelta: {x: 0, y: 45.75061}
|
||||||
m_Pivot: {x: 0, y: 1}
|
m_Pivot: {x: 0, y: 1}
|
||||||
--- !u!114 &1585142380
|
--- !u!114 &1585142380
|
||||||
|
@ -70080,10 +70081,10 @@ MonoBehaviour:
|
||||||
colorSkyBase: {r: 0.6054902, g: 0.7090196, b: 0.7968628, a: 0.8}
|
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}
|
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}
|
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}
|
colorSkyAmbient: {r: 1, g: 1, b: 1, a: 1}
|
||||||
colorClouds: {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}
|
colorSkyboxGround: {r: 0.1102941, g: 0.08836951, b: 0.06487888, a: 1}
|
||||||
colorSkyboxMie: {r: 1, g: 1, b: 1, a: 1}
|
colorSkyboxMie: {r: 1, g: 1, b: 1, a: 1}
|
||||||
displayTime: '[ 10:30:00 AM] [ 3/6/1027 ad]'
|
displayTime: '[ 10:30:00 AM] [ 3/6/1027 ad]'
|
||||||
|
@ -70421,7 +70422,7 @@ MonoBehaviour:
|
||||||
m_PreInfinity: 2
|
m_PreInfinity: 2
|
||||||
m_PostInfinity: 2
|
m_PostInfinity: 2
|
||||||
m_RotationOrder: 4
|
m_RotationOrder: 4
|
||||||
randSeed: 335766515
|
randSeed: 430582031
|
||||||
isDoingTransition: 0
|
isDoingTransition: 0
|
||||||
minimumHeight: 0
|
minimumHeight: 0
|
||||||
--- !u!114 &1820978574
|
--- !u!114 &1820978574
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
{
|
{
|
||||||
public Button startFormationBtn;
|
public Button startFormationBtn;
|
||||||
public Button submitFormationBtn;
|
public Button submitFormationBtn;
|
||||||
|
public Button cancelFormationBtn;
|
||||||
public bool isStartFormation;
|
public bool isStartFormation;
|
||||||
public List<FormationInfo> formationInfos = new List<FormationInfo>();
|
public List<FormationInfo> formationInfos = new List<FormationInfo>();
|
||||||
public FormationInfo formationInfo;
|
public FormationInfo formationInfo;
|
||||||
|
@ -27,6 +28,15 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
{
|
{
|
||||||
startFormationBtn.onClick.AddListener(OnStartFormation);
|
startFormationBtn.onClick.AddListener(OnStartFormation);
|
||||||
submitFormationBtn.onClick.AddListener(OnSubmit);
|
submitFormationBtn.onClick.AddListener(OnSubmit);
|
||||||
|
cancelFormationBtn.onClick.AddListener(OnCancel);
|
||||||
|
CheckBtns(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckBtns(int index)
|
||||||
|
{
|
||||||
|
startFormationBtn.gameObject.SetActive(index == 0);
|
||||||
|
submitFormationBtn.gameObject.SetActive(index == 1);
|
||||||
|
cancelFormationBtn.gameObject.SetActive(index == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -63,7 +73,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置组中得无人机所有航线
|
/// 设置组中得无人机所有航线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetUAVMGroupAirRoute(int uavmGroupID, Vector3 pos)
|
public void SetUAVMGroupAirRoute(int uavmGroupID, Vector3 pos, DistanceMeasurement _airRoute)
|
||||||
{
|
{
|
||||||
List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
||||||
for (int i = 0; i < formationInfos.Count; i++)
|
for (int i = 0; i < formationInfos.Count; i++)
|
||||||
|
@ -76,6 +86,11 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
}
|
}
|
||||||
for (int j = 0; j < uavms.Count; j++)
|
for (int j = 0; j < uavms.Count; j++)
|
||||||
{
|
{
|
||||||
|
if (!uavms[j].airRoute)
|
||||||
|
{
|
||||||
|
uavms[j].airRoute = _airRoute.gameObject;
|
||||||
|
uavms[j].SetStartPos(_airRoute.PosPrefab);
|
||||||
|
}
|
||||||
uavms[j].positions.Enqueue(pos);
|
uavms[j].positions.Enqueue(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,37 +115,48 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAirRouteObj(int uavmGroupID, GameObject _airRoute)
|
//public void SetAirRouteObj(int uavmGroupID, GameObject _airRoute)
|
||||||
{
|
//{
|
||||||
List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
// List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
||||||
for (int i = 0; i < formationInfos.Count; i++)
|
// for (int i = 0; i < formationInfos.Count; i++)
|
||||||
{
|
// {
|
||||||
int indexI = i;
|
// int indexI = i;
|
||||||
if (formationInfos[indexI].groupName == uavmGroupID)
|
// if (formationInfos[indexI].groupName == uavmGroupID)
|
||||||
{
|
// {
|
||||||
uavms = formationInfos[indexI].uavms;
|
// uavms = formationInfos[indexI].uavms;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
for (int j = 0; j < uavms.Count; j++)
|
// for (int j = 0; j < uavms.Count; j++)
|
||||||
{
|
// {
|
||||||
if (!uavms[j].airRoute)
|
// if (!uavms[j].airRoute)
|
||||||
{
|
// {
|
||||||
uavms[j].airRoute = _airRoute;
|
// uavms[j].airRoute = _airRoute;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public void OnStartFormation()
|
public void OnStartFormation()
|
||||||
{
|
{
|
||||||
isStartFormation = true;
|
isStartFormation = true;
|
||||||
formationInfo = new FormationInfo();
|
formationInfo = new FormationInfo();
|
||||||
formationInfo.groupName = formationInfos.Count;
|
formationInfo.groupName = formationInfos.Count;
|
||||||
|
CheckBtns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSubmit()
|
public void OnSubmit()
|
||||||
{
|
{
|
||||||
isStartFormation = false;
|
isStartFormation = false;
|
||||||
if (!formationInfos.Contains(formationInfo))
|
if (formationInfo.uavms.Count > 0)
|
||||||
formationInfos.Add(formationInfo);
|
{
|
||||||
|
if (!formationInfos.Contains(formationInfo))
|
||||||
|
formationInfos.Add(formationInfo);
|
||||||
|
}
|
||||||
|
CheckBtns(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnCancel()
|
||||||
|
{
|
||||||
|
formationInfo = null;
|
||||||
|
CheckBtns(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,8 @@ public class DistanceMeasurement : MonoBehaviour
|
||||||
unmannedAerialVehicleManage.positions.Enqueue(go.transform.position);
|
unmannedAerialVehicleManage.positions.Enqueue(go.transform.position);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FormationManager.Instance.SetUAVMGroupAirRoute(unmannedAerialVehicleManage.groupId, go.transform.position);
|
FormationManager.Instance.SetUAVMGroupAirRoute(unmannedAerialVehicleManage.groupId, go.transform.position,this);
|
||||||
|
|
||||||
}
|
}
|
||||||
go.transform.SetParent(transform);
|
go.transform.SetParent(transform);
|
||||||
}
|
}
|
||||||
|
|
|
@ -988,7 +988,6 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
positions.Enqueue(startPos.transform.position);
|
positions.Enqueue(startPos.transform.position);
|
||||||
|
|
||||||
}
|
}
|
||||||
FormationManager.Instance.SetAirRouteObj(groupId, airRoute);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1008,9 +1007,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
startPos = Instantiate(distanceMeasurement.PosPrefab, transform);
|
SetStartPos(distanceMeasurement.PosPrefab);
|
||||||
startPos.transform.localScale = Vector3.zero;
|
|
||||||
startPos.transform.position = new Vector3(transform.position.x, hight, transform.position.z);
|
|
||||||
distanceMeasurement.isPathCanBePlanned = true;
|
distanceMeasurement.isPathCanBePlanned = true;
|
||||||
distanceMeasurement.markers[0] = startPos.transform;
|
distanceMeasurement.markers[0] = startPos.transform;
|
||||||
positions.Enqueue(startPos.transform.position);
|
positions.Enqueue(startPos.transform.position);
|
||||||
|
@ -1018,10 +1015,16 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
FormationManager.Instance.SetAirRouteObj(groupId, airRoute);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetStartPos(GameObject _distanceMeasurement)
|
||||||
|
{
|
||||||
|
startPos = Instantiate(_distanceMeasurement, transform);
|
||||||
|
startPos.transform.localScale = Vector3.zero;
|
||||||
|
startPos.transform.position = new Vector3(transform.position.x, hight, transform.position.z);
|
||||||
|
}
|
||||||
|
|
||||||
private bool isMove = true;
|
private bool isMove = true;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 按规划路径开始移动
|
/// 按规划路径开始移动
|
||||||
|
|
Loading…
Reference in New Issue