From 80ee5d760af151c71cfb8049c0de0a4281862399 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Tue, 30 Jan 2024 20:16:21 +0300 Subject: [PATCH] refactor: Unnecessary Declarations Removed --- Game/GamePong.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Game/GamePong.cs b/Game/GamePong.cs index 122e323..a441407 100644 --- a/Game/GamePong.cs +++ b/Game/GamePong.cs @@ -89,43 +89,37 @@ public class GamePong : Game gameObjectLeftPaddle.BehaviourController.AddBehaviour(Keys.W, Keys.S, 228f, -228f, 400f); gameObjectLeftPaddle.BehaviourController.AddBehaviour(Shape.Box); - RigidBody2D rigidBodyLeftPaddle = gameObjectLeftPaddle.BehaviourController.AddBehaviour(); - rigidBodyLeftPaddle.IsStatic = true; + gameObjectLeftPaddle.BehaviourController.AddBehaviour().IsStatic = true; IGameObject gameObjectRightPaddle = gameManager.InstantiateGameObject().SetGameObject("Right Paddle"); gameObjectRightPaddle.Transform.SetTransform(position: new Vector2D(468f, 0f), scale: new Vector2D(15f, 60f)); gameObjectRightPaddle.BehaviourController.AddBehaviour(Keys.Up, Keys.Down, 228f, -228f, 400f); gameObjectRightPaddle.BehaviourController.AddBehaviour(Shape.Box); - RigidBody2D rigidBodyRightPaddle = gameObjectRightPaddle.BehaviourController.AddBehaviour(); - rigidBodyRightPaddle.IsStatic = true; + gameObjectRightPaddle.BehaviourController.AddBehaviour().IsStatic = true; //////////////////////////////////////////////////////////////////////////////////// IGameObject gameObjectWallTop = gameManager.InstantiateGameObject().SetGameObject("Wall Top"); gameObjectWallTop.Transform.SetTransform(position: new Vector2D(0f, 308f), scale: new Vector2D(552f, 20f)); gameObjectWallTop.BehaviourController.AddBehaviour(Shape.Box); - RigidBody2D rigidBodyWallTop = gameObjectWallTop.BehaviourController.AddBehaviour(); - rigidBodyWallTop.IsStatic = true; + gameObjectWallTop.BehaviourController.AddBehaviour().IsStatic = true; IGameObject gameObjectWallBottom = gameManager.InstantiateGameObject().SetGameObject("Wall Bottom"); gameObjectWallBottom.Transform.SetTransform(position: new Vector2D(0f, -308f), scale: new Vector2D(552f, 20f)); gameObjectWallBottom.BehaviourController.AddBehaviour(Shape.Box); - RigidBody2D rigidBodyWallBottom = gameObjectWallBottom.BehaviourController.AddBehaviour(); - rigidBodyWallBottom.IsStatic = true; + gameObjectWallBottom.BehaviourController.AddBehaviour().IsStatic = true; IGameObject gameObjectWallRight = gameManager.InstantiateGameObject().SetGameObject("Wall Right"); gameObjectWallRight.Transform.SetTransform(position: new Vector2D(532f, 0f), scale: new Vector2D(20f, 328f)); gameObjectWallRight.BehaviourController.AddBehaviour((Action)pongManager.ScoreToLeft); gameObjectWallRight.BehaviourController.AddBehaviour(Shape.Box); - RigidBody2D rigidBodyWallRight = gameObjectWallRight.BehaviourController.AddBehaviour(); - rigidBodyWallRight.IsStatic = true; + gameObjectWallRight.BehaviourController.AddBehaviour().IsStatic = true; IGameObject gameObjectWallLeft = gameManager.InstantiateGameObject().SetGameObject("Wall Left"); gameObjectWallLeft.Transform.SetTransform(position: new Vector2D(-532f, 0f), scale: new Vector2D(20f, 328f)); gameObjectWallLeft.BehaviourController.AddBehaviour((Action)pongManager.ScoreToRight); gameObjectWallLeft.BehaviourController.AddBehaviour(Shape.Box); - RigidBody2D rigidBodyWallLeft = gameObjectWallLeft.BehaviourController.AddBehaviour(); - rigidBodyWallLeft.IsStatic = true; + gameObjectWallLeft.BehaviourController.AddBehaviour().IsStatic = true; ////////////////////////////////////////////////////////////////////////////////////