This commit is contained in:
parent
17aa410687
commit
09f2d8a639
|
@ -38,7 +38,7 @@ RenderSettings:
|
|||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 1113159741}
|
||||
m_IndirectSpecularColor: {r: 0.16235358, g: 0.30609837, b: 0.66879046, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.1623027, g: 0.3060007, b: 0.6686146, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
|
@ -37019,7 +37019,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191145835787467, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
|
||||
value: 3
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145835787467, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37049,7 +37049,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191145835787467, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_Arguments.m_BoolArgument
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145920499402, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37126,6 +37126,11 @@ PrefabInstance:
|
|||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145983482008, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146020959760, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
@ -37236,6 +37241,46 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: WRJSetMenu
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146224171878, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146224171878, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146224171878, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146869712338, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146869712338, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146869712338, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146896791639, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146896791639, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146970283770, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
|
||||
|
@ -37341,6 +37386,21 @@ PrefabInstance:
|
|||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191147329131398, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191147329131398, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191147329131398, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 49c7b765b5b8a8845aad4c0acd9753a8, type: 3}
|
||||
--- !u!224 &729007801 stripped
|
||||
|
@ -63057,7 +63117,7 @@ MonoBehaviour:
|
|||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
randSeed: 461563218
|
||||
randSeed: 867532187
|
||||
isDoingTransition: 0
|
||||
minimumHeight: 0
|
||||
--- !u!114 &1820978574
|
||||
|
|
|
@ -136,16 +136,22 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
unmannedAerialVehicleManages.Add(this);
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
Formation(1);//默认阵型
|
||||
//Formation(1);//默认阵型
|
||||
// 订阅布尔值变化事件
|
||||
OnActivationChanged += OnActivationChangedHandler;
|
||||
|
||||
}
|
||||
|
||||
[ContextMenu("Test")]
|
||||
public void Test()
|
||||
{
|
||||
MatrixFormation(30, 6);//根据想定数据去设置无人机数量
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(isStartRehearsing && equipmentCommon.isPlayer)
|
||||
if (isStartRehearsing && equipmentCommon.isPlayer)
|
||||
{
|
||||
switch (pattern)
|
||||
{
|
||||
|
@ -164,7 +170,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
|
||||
var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null);
|
||||
if (_unmannedAerialVehicle.Count==0)
|
||||
if (_unmannedAerialVehicle.Count == 0)
|
||||
{
|
||||
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", equipmentCommon.deviceID);
|
||||
Debug.Log(nowData);
|
||||
|
@ -172,13 +178,14 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
UploadLog(equipmentCommon.deviceID);
|
||||
WWWForm headers = new WWWForm();
|
||||
headers.AddField("id", equipmentCommon.deviceID);
|
||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => {
|
||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||
{
|
||||
Debug.Log(data);
|
||||
Destroy(gameObject);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -200,7 +207,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
WWWForm wWWForm = new WWWForm();
|
||||
wWWForm.AddField("data", uploadLogMainJson);
|
||||
Debug.Log(uploadLogMainJson);
|
||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data =>
|
||||
{
|
||||
Debug.Log(data);
|
||||
}));
|
||||
}
|
||||
|
@ -237,7 +245,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
if (isEngagedTarget) return;
|
||||
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
|
||||
List<Collider> colliders1 = new List<Collider>();
|
||||
for (int i=0;i< colliders.Count; i++)
|
||||
for (int i = 0; i < colliders.Count; i++)
|
||||
{
|
||||
if (colliders[i].transform.tag == "AttackTarget")
|
||||
colliders1.Add(colliders[i]);
|
||||
|
@ -367,7 +375,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
unmannedAerialVehicles[i].dataLinkCommunicationFrequency = dataLinkCommunicationFrequency;
|
||||
unmannedAerialVehicles[i].electronicReconnaissanceCapability = electronicReconnaissanceCapability;
|
||||
unmannedAerialVehicles[i].opticalReconnaissanceCapability = opticalReconnaissanceCapability;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -400,6 +408,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 无人机雁式阵型
|
||||
/// </summary>
|
||||
|
@ -437,6 +447,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 矩阵阵型
|
||||
/// </summary>
|
||||
|
@ -470,6 +482,47 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据想定数据去设置无人机数量
|
||||
/// </summary>
|
||||
private void MatrixFormation(int rows, int wrjCount)
|
||||
{
|
||||
for (int i = 0; i < unmannedAerialVehicles.Count; i++)
|
||||
{
|
||||
unmannedAerialVehicles[i].gameObject.SetActive(false);
|
||||
}
|
||||
for (int i = 0; i < wrjCount; i++)
|
||||
{
|
||||
unmannedAerialVehicles[i].gameObject.SetActive(true);
|
||||
}
|
||||
float offsetX = 2.0f; // 子物体之间的水平间距
|
||||
float offsetY = 2.0f; // 子物体之间的垂直间距
|
||||
float offsetZ = 2.0f; // 子物体之间的垂直间距
|
||||
int currentCount = 0;
|
||||
int cols = CanDivideEvenly(totalObjects, rows) ? totalObjects / rows : totalObjects / rows + 1;
|
||||
for (int row = 0; row < rows; row++)
|
||||
{
|
||||
for (int col = 0; col < cols; col++)
|
||||
{
|
||||
if (currentCount < totalObjects)
|
||||
{
|
||||
Vector3 position = new Vector3(col * offsetX, 0, -row * offsetZ);
|
||||
if (unmannedAerialVehicles[currentCount])
|
||||
unmannedAerialVehicles[currentCount].transform.localPosition = position;
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
BoxCollider box = transform.GetComponent<BoxCollider>();
|
||||
if (box)
|
||||
{
|
||||
Debug.Log("cols..:" + cols);
|
||||
Debug.Log("rows..:" + rows);
|
||||
box.center = new Vector3(cols - 1, 0, -(wrjCount - 1));
|
||||
box.size = new Vector3(cols * 2, 1, 2 * wrjCount);
|
||||
}
|
||||
}
|
||||
|
||||
bool CanDivideEvenly(int dividend, int divisor)
|
||||
{
|
||||
return dividend % divisor == 0;
|
||||
|
@ -546,7 +599,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
yield return new WaitForSeconds(_time); // 等待一帧时间
|
||||
isMove = true;
|
||||
}
|
||||
public IEnumerator MoveObjectAlongPath(Vector3 _positions,bool _isMove) // 协程:按路线移动物体
|
||||
public IEnumerator MoveObjectAlongPath(Vector3 _positions, bool _isMove) // 协程:按路线移动物体
|
||||
{
|
||||
Vector3 targetPosition = new Vector3(_positions.x, 200, _positions.z);// 目标位置为当前顶点坐标
|
||||
float _distance = Vector3.Distance(transform.position, targetPosition);
|
||||
|
|
Loading…
Reference in New Issue