refactor: Unnecessary Declarations Removed

This commit is contained in:
Syntriax 2024-01-30 20:16:21 +03:00
parent de2d5fb446
commit 80ee5d760a
1 changed files with 6 additions and 12 deletions

View File

@ -89,43 +89,37 @@ public class GamePong : Game
gameObjectLeftPaddle.BehaviourController.AddBehaviour<MovementBoxBehaviour>(Keys.W, Keys.S, 228f, -228f, 400f); gameObjectLeftPaddle.BehaviourController.AddBehaviour<MovementBoxBehaviour>(Keys.W, Keys.S, 228f, -228f, 400f);
gameObjectLeftPaddle.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box); gameObjectLeftPaddle.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box);
RigidBody2D rigidBodyLeftPaddle = gameObjectLeftPaddle.BehaviourController.AddBehaviour<RigidBody2D>(); gameObjectLeftPaddle.BehaviourController.AddBehaviour<RigidBody2D>().IsStatic = true;
rigidBodyLeftPaddle.IsStatic = true;
IGameObject gameObjectRightPaddle = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Right Paddle"); IGameObject gameObjectRightPaddle = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Right Paddle");
gameObjectRightPaddle.Transform.SetTransform(position: new Vector2D(468f, 0f), scale: new Vector2D(15f, 60f)); gameObjectRightPaddle.Transform.SetTransform(position: new Vector2D(468f, 0f), scale: new Vector2D(15f, 60f));
gameObjectRightPaddle.BehaviourController.AddBehaviour<MovementBoxBehaviour>(Keys.Up, Keys.Down, 228f, -228f, 400f); gameObjectRightPaddle.BehaviourController.AddBehaviour<MovementBoxBehaviour>(Keys.Up, Keys.Down, 228f, -228f, 400f);
gameObjectRightPaddle.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box); gameObjectRightPaddle.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box);
RigidBody2D rigidBodyRightPaddle = gameObjectRightPaddle.BehaviourController.AddBehaviour<RigidBody2D>(); gameObjectRightPaddle.BehaviourController.AddBehaviour<RigidBody2D>().IsStatic = true;
rigidBodyRightPaddle.IsStatic = true;
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
IGameObject gameObjectWallTop = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Top"); IGameObject gameObjectWallTop = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Top");
gameObjectWallTop.Transform.SetTransform(position: new Vector2D(0f, 308f), scale: new Vector2D(552f, 20f)); gameObjectWallTop.Transform.SetTransform(position: new Vector2D(0f, 308f), scale: new Vector2D(552f, 20f));
gameObjectWallTop.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box); gameObjectWallTop.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box);
RigidBody2D rigidBodyWallTop = gameObjectWallTop.BehaviourController.AddBehaviour<RigidBody2D>(); gameObjectWallTop.BehaviourController.AddBehaviour<RigidBody2D>().IsStatic = true;
rigidBodyWallTop.IsStatic = true;
IGameObject gameObjectWallBottom = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Bottom"); IGameObject gameObjectWallBottom = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Bottom");
gameObjectWallBottom.Transform.SetTransform(position: new Vector2D(0f, -308f), scale: new Vector2D(552f, 20f)); gameObjectWallBottom.Transform.SetTransform(position: new Vector2D(0f, -308f), scale: new Vector2D(552f, 20f));
gameObjectWallBottom.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box); gameObjectWallBottom.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box);
RigidBody2D rigidBodyWallBottom = gameObjectWallBottom.BehaviourController.AddBehaviour<RigidBody2D>(); gameObjectWallBottom.BehaviourController.AddBehaviour<RigidBody2D>().IsStatic = true;
rigidBodyWallBottom.IsStatic = true;
IGameObject gameObjectWallRight = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Right"); IGameObject gameObjectWallRight = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Right");
gameObjectWallRight.Transform.SetTransform(position: new Vector2D(532f, 0f), scale: new Vector2D(20f, 328f)); gameObjectWallRight.Transform.SetTransform(position: new Vector2D(532f, 0f), scale: new Vector2D(20f, 328f));
gameObjectWallRight.BehaviourController.AddBehaviour<ScoreBoundary>((Action)pongManager.ScoreToLeft); gameObjectWallRight.BehaviourController.AddBehaviour<ScoreBoundary>((Action)pongManager.ScoreToLeft);
gameObjectWallRight.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box); gameObjectWallRight.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box);
RigidBody2D rigidBodyWallRight = gameObjectWallRight.BehaviourController.AddBehaviour<RigidBody2D>(); gameObjectWallRight.BehaviourController.AddBehaviour<RigidBody2D>().IsStatic = true;
rigidBodyWallRight.IsStatic = true;
IGameObject gameObjectWallLeft = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Left"); IGameObject gameObjectWallLeft = gameManager.InstantiateGameObject<GameObject>().SetGameObject("Wall Left");
gameObjectWallLeft.Transform.SetTransform(position: new Vector2D(-532f, 0f), scale: new Vector2D(20f, 328f)); gameObjectWallLeft.Transform.SetTransform(position: new Vector2D(-532f, 0f), scale: new Vector2D(20f, 328f));
gameObjectWallLeft.BehaviourController.AddBehaviour<ScoreBoundary>((Action)pongManager.ScoreToRight); gameObjectWallLeft.BehaviourController.AddBehaviour<ScoreBoundary>((Action)pongManager.ScoreToRight);
gameObjectWallLeft.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box); gameObjectWallLeft.BehaviourController.AddBehaviour<ShapeBehaviour>(Shape.Box);
RigidBody2D rigidBodyWallLeft = gameObjectWallLeft.BehaviourController.AddBehaviour<RigidBody2D>(); gameObjectWallLeft.BehaviourController.AddBehaviour<RigidBody2D>().IsStatic = true;
rigidBodyWallLeft.IsStatic = true;
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////