From e070dda3c81f5e70d7dc24e120c0dfd41127c9e7 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 27 Nov 2023 11:00:34 +0300 Subject: [PATCH] chore: Reverted "Don't Ask" 1 & 2 --- Game/Game1.cs | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/Game/Game1.cs b/Game/Game1.cs index da288d2..48b064c 100644 --- a/Game/Game1.cs +++ b/Game/Game1.cs @@ -15,8 +15,6 @@ public class Game1 : Game private GraphicsDeviceManager _graphics; private SpriteBatch _spriteBatch; private GameManager gameManager = null!; - private GameObject gameObjectLeft; - private GameObject gameObjectRight; public Game1() { @@ -42,21 +40,21 @@ public class Game1 : Game Texture2D texture2D = Content.Load("Sprites/Pixel"); Sprite sprite = new Sprite() { Texture2D = texture2D }; - gameObjectLeft = gameManager.InstantiateGameObject(); + IGameObject gameObjectLeft = gameManager.InstantiateGameObject(); gameObjectLeft.Name = "Left"; gameObjectLeft.Transform.Position = new Vector2(Window.ClientBounds.Width * .1f, Window.ClientBounds.Height * .5f); gameObjectLeft.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f); gameObjectLeft.BehaviourController.AddBehaviour(); gameObjectLeft.BehaviourController.AddBehaviour(Keys.S, Keys.W, 200f); - gameObjectLeft.BehaviourController.AddBehaviour(Color.Gold, null, null, null).Assign(sprite); + gameObjectLeft.BehaviourController.AddBehaviour().Assign(sprite); - gameObjectRight = gameManager.InstantiateGameObject(); + IGameObject gameObjectRight = gameManager.InstantiateGameObject(); gameObjectRight.Name = "Right"; gameObjectRight.Transform.Position = new Vector2(Window.ClientBounds.Width * .9f, Window.ClientBounds.Height * .5f); gameObjectRight.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f); gameObjectRight.BehaviourController.AddBehaviour(); gameObjectRight.BehaviourController.AddBehaviour(Keys.Down, Keys.Up, 200f); - gameObjectRight.BehaviourController.AddBehaviour(Color.AliceBlue, null, null, null).Assign(sprite); + gameObjectRight.BehaviourController.AddBehaviour().Assign(sprite); // TODO: use this.Content to load your game content here } @@ -74,31 +72,6 @@ public class Game1 : Game _graphics.ApplyChanges(); } - if (Keyboard.GetState().IsKeyDown(Keys.H)) - { - gameManager.RemoveGameObject(gameObjectLeft); - gameManager.RemoveGameObject(gameObjectRight); - - IBehaviourController lbc = gameObjectLeft.BehaviourController; - IBehaviourController rbc = gameObjectRight.BehaviourController; - - Console.WriteLine($"LeftBehaviourController: {lbc.GameObject.Name}"); - Console.WriteLine($"RightBehaviourController: {rbc.GameObject.Name}"); - - Console.WriteLine($"gameObjectLeft.Assign(rbc): {gameObjectLeft.Assign(rbc)}"); - Console.WriteLine($"gameObjectRight.Assign(lbc): {gameObjectRight.Assign(lbc)}"); - - Console.WriteLine($"lbc.Assign(gameObjectRight): {lbc.Assign(gameObjectRight)}"); - Console.WriteLine($"rbc.Assign(gameObjectLeft): {rbc.Assign(gameObjectLeft)}"); - - gameManager.RegisterGameObject(gameObjectLeft); - gameManager.RegisterGameObject(gameObjectRight); - - Console.WriteLine($"LeftBehaviourController: {lbc.GameObject.Name}"); - Console.WriteLine($"RightBehaviourController: {rbc.GameObject.Name}"); - Console.WriteLine($"//////////////////////////////////////////////////"); - } - // TODO: Add your update logic here gameManager.Update(gameTime);