fix: Ball Not Resetting Position On Reset
This commit is contained in:
parent
3580469a07
commit
0b2158cc7b
|
@ -71,6 +71,7 @@ public class Game1 : Game
|
||||||
gameManager.Camera = cameraBehaviour;
|
gameManager.Camera = cameraBehaviour;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
IGameObject gameObjectPongManager = gameManager.InstantiateGameObject<GameObject>();
|
IGameObject gameObjectPongManager = gameManager.InstantiateGameObject<GameObject>();
|
||||||
gameObjectPongManager.Name = "Pong Game Manager";
|
gameObjectPongManager.Name = "Pong Game Manager";
|
||||||
pongScoreboard = gameObjectPongManager.BehaviourController.AddBehaviour<PongScoreboard>(5);
|
pongScoreboard = gameObjectPongManager.BehaviourController.AddBehaviour<PongScoreboard>(5);
|
||||||
|
@ -180,6 +181,7 @@ public class Game1 : Game
|
||||||
pongScoreboard.OnReset += () =>
|
pongScoreboard.OnReset += () =>
|
||||||
{
|
{
|
||||||
gameObjectBall.StateEnable.Enabled = true;
|
gameObjectBall.StateEnable.Enabled = true;
|
||||||
|
rigidBodyBall.BehaviourController.GameObject.Transform.Position = Vector2D.Zero;
|
||||||
rigidBodyBall.Velocity = Vector2D.One * movementBallBehaviour.Speed;
|
rigidBodyBall.Velocity = Vector2D.One * movementBallBehaviour.Speed;
|
||||||
textBehaviourLeft.Text = pongScoreboard.ScoreLeft.ToString();
|
textBehaviourLeft.Text = pongScoreboard.ScoreLeft.ToString();
|
||||||
textBehaviourRight.Text = pongScoreboard.ScoreRight.ToString();
|
textBehaviourRight.Text = pongScoreboard.ScoreRight.ToString();
|
||||||
|
|
Loading…
Reference in New Issue