[Refactor] Made other orbitals attached to a parent holder

This commit is contained in:
Pasha Bibko
2025-11-28 17:29:33 +00:00
parent 80be4cc853
commit 569056a9a5

View File

@@ -28,6 +28,8 @@ public partial class OrbitalBehaviour
private OrbitalBehaviour m_PlayerInstance; private OrbitalBehaviour m_PlayerInstance;
private GameObject m_ModiferParent;
private GameObject m_EnemyParent;
private GameObject m_RingParent; private GameObject m_RingParent;
private const int CirclePoints = 100; private const int CirclePoints = 100;
@@ -56,6 +58,8 @@ public partial class OrbitalBehaviour
Instance.PrecalculatePositions(); Instance.PrecalculatePositions();
Instance.StartCoroutine(RestartSimulation()); Instance.StartCoroutine(RestartSimulation());
Instance.m_ModiferParent = new GameObject("ModifierParent");
Instance.m_EnemyParent = new GameObject("EnemyHolder");
Instance.m_RingParent = new GameObject("RingHolder"); Instance.m_RingParent = new GameObject("RingHolder");
} }
@@ -127,7 +131,7 @@ public partial class OrbitalBehaviour
m_CurrentRingAllowsSpawning = Random.Range(0, 25) != 0; m_CurrentRingAllowsSpawning = Random.Range(0, 25) != 0;
if (!m_CurrentRingAllowsSpawning && m_AllowPlayerInput) if (!m_CurrentRingAllowsSpawning && m_AllowPlayerInput)
{ {
Instantiate(Settings.Instance.ModifierPrefab); Instantiate(Settings.Instance.ModifierPrefab, m_ModiferParent.transform);
} }
} }
@@ -221,7 +225,7 @@ public partial class OrbitalBehaviour
if (Random.Range(0, 20) == 0 && m_AllowPlayerInput && m_CurrentRingAllowsSpawning) if (Random.Range(0, 20) == 0 && m_AllowPlayerInput && m_CurrentRingAllowsSpawning)
{ {
Instantiate(Settings.Instance.EnemyPrefab); Instantiate(Settings.Instance.EnemyPrefab, m_EnemyParent.transform);
} }
} }