Merge branch 'master' of http://git.umayle.com:2023/yulong/NewN_UAVPlane
This commit is contained in:
commit
71914a478e
|
@ -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
|
||||
|
|
|
@ -710,40 +710,40 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
/// </summary>
|
||||
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<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);
|
||||
}
|
||||
//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)
|
||||
|
|
Loading…
Reference in New Issue