fix: Ball Not Resetting Position On Reset

This commit is contained in:
Syntriax 2024-01-28 16:25:53 +03:00
parent 3580469a07
commit 0b2158cc7b
1 changed files with 2 additions and 0 deletions

View File

@ -71,6 +71,7 @@ public class Game1 : Game
gameManager.Camera = cameraBehaviour;
////////////////////////////////////////////////////////////////////////////////////
IGameObject gameObjectPongManager = gameManager.InstantiateGameObject<GameObject>();
gameObjectPongManager.Name = "Pong Game Manager";
pongScoreboard = gameObjectPongManager.BehaviourController.AddBehaviour<PongScoreboard>(5);
@ -180,6 +181,7 @@ public class Game1 : Game
pongScoreboard.OnReset += () =>
{
gameObjectBall.StateEnable.Enabled = true;
rigidBodyBall.BehaviourController.GameObject.Transform.Position = Vector2D.Zero;
rigidBodyBall.Velocity = Vector2D.One * movementBallBehaviour.Speed;
textBehaviourLeft.Text = pongScoreboard.ScoreLeft.ToString();
textBehaviourRight.Text = pongScoreboard.ScoreRight.ToString();