From 9f3e9b7673a0175114ca4993ad50ea1a52d91a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=90=8D?= <3077614386@qq.com> Date: Tue, 23 Jan 2024 19:48:42 +0800 Subject: [PATCH] 1 --- .../Prefebs/Models/moder/无人机List.prefab | 4 +- .../UAV/UnmannedAerialVehicleManage.cs | 68 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab b/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab index 81dc7e49..7a841193 100644 --- a/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab +++ b/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab @@ -475,8 +475,8 @@ BoxCollider: m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 14, y: 1, z: 8} - m_Center: {x: 0, y: 0, z: -3} + m_Size: {x: 3.1049147, y: 0.9891114, z: 3.2810247} + m_Center: {x: 0.060157776, y: 0.11486983, z: -1.1351347} --- !u!114 &1432105532577387308 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs index 64c4ffb5..487416af 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs @@ -710,40 +710,40 @@ public class UnmannedAerialVehicleManage : MonoBehaviour /// public 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(); - 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); - } + //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(); + //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)