diff --git a/Assets/Scripts/Game/Ball.cs b/Assets/Scripts/Game/Ball.cs index 850e4b6..f832052 100644 --- a/Assets/Scripts/Game/Ball.cs +++ b/Assets/Scripts/Game/Ball.cs @@ -28,6 +28,11 @@ namespace Game { private void Start() { Rb.velocity = new Vector2(0, 25); + Rb.position = new Vector2(1, 0); + } + + private void FixedUpdate() { + } } } diff --git a/Assets/Scripts/Game/GameManager.cs b/Assets/Scripts/Game/GameManager.cs index 0cff2b9..2661816 100644 --- a/Assets/Scripts/Game/GameManager.cs +++ b/Assets/Scripts/Game/GameManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using Unity.Netcode; using Unity.VisualScripting; using UnityEngine; @@ -90,5 +91,15 @@ namespace Game { Tests(); } + private void FixedUpdate() { + foreach (var ball in Balls.Where(b => !b.IsAlive)) + Destroy(ball.gameObject); + + int count = Balls.RemoveAll(b => !b.IsAlive); + for (int _ = 0; _ < count; _++) { + Balls.Add(Instantiate(ballPrefab).GetComponent()); + } + } + } }