|
|
|
@ -90,23 +90,19 @@ namespace Unity.Multiplayer.Samples.BossRoom
|
|
|
|
|
SyncPlatformsClientRpc(platformIDs, arrangedPositions.ToArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List< Vector3 > ArrangePlatforms( List< Platform > activePlatforms ) {
|
|
|
|
|
const float startAngle = 90f ; // Start from top
|
|
|
|
|
|
|
|
|
|
private List<Vector3> ArrangePlatforms(List<Platform> activePlatforms)
|
|
|
|
|
{
|
|
|
|
|
int platformCount = activePlatforms.Count;
|
|
|
|
|
|
|
|
|
|
if (platformCount == 0)
|
|
|
|
|
{
|
|
|
|
|
if ( activePlatforms is not { Count: > 1, } ) {
|
|
|
|
|
Debug.LogError($"[ArrangePlatforms] No active platforms found!");
|
|
|
|
|
return new List<Vector3>();
|
|
|
|
|
return new( ) ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float startAngle = 90f; // Start from top
|
|
|
|
|
List<Vector3> arrangedPositions = new List<Vector3>();
|
|
|
|
|
int platformCount = activePlatforms.Count ;
|
|
|
|
|
List< Vector3 > arrangedPositions = new( ) ;
|
|
|
|
|
|
|
|
|
|
// Special case: If 2 platforms, place them opposite to each other
|
|
|
|
|
if (platformCount == 2)
|
|
|
|
|
{
|
|
|
|
|
if ( platformCount is 2 ) {
|
|
|
|
|
arrangedPositions.Add(centerPoint.position + new Vector3(shapeRadius, 0, 0)); // Right side
|
|
|
|
|
arrangedPositions.Add(centerPoint.position + new Vector3(-shapeRadius, 0, 0)); // Left side
|
|
|
|
|
}
|
|
|
|
@ -114,19 +110,20 @@ namespace Unity.Multiplayer.Samples.BossRoom
|
|
|
|
|
{
|
|
|
|
|
float angleStep = 360f / platformCount;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < platformCount; i++)
|
|
|
|
|
for (int i = 0; i < platformCount; ++i)
|
|
|
|
|
{
|
|
|
|
|
float angle = startAngle + (i * angleStep);
|
|
|
|
|
float radians = angle * Mathf.Deg2Rad;
|
|
|
|
|
|
|
|
|
|
Vector3 newPosition = new Vector3(
|
|
|
|
|
centerPoint.position.x + shapeRadius * Mathf.Cos(radians),
|
|
|
|
|
centerPoint.position.y,
|
|
|
|
|
centerPoint.position.z + shapeRadius * Mathf.Sin(radians)
|
|
|
|
|
);
|
|
|
|
|
Vector3 newPosition = new (
|
|
|
|
|
centerPoint.position.x + shapeRadius * Mathf.Cos(radians),
|
|
|
|
|
centerPoint.position.y,
|
|
|
|
|
centerPoint.position.z + shapeRadius * Mathf.Sin(radians)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
arrangedPositions.Add(newPosition);
|
|
|
|
|
Debug.Log($"[ArrangePlatforms] Assigned position {i}: {newPosition} to Platform ID: {activePlatforms[i].PlatformID.Value}");
|
|
|
|
|
Debug.Log($"[ArrangePlatforms] Assigned position {i}: {newPosition} to Platform ID: " +
|
|
|
|
|
$"{activePlatforms[i].PlatformID.Value}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|