chore: Reverted "Don't Ask" 1 & 2

This commit is contained in:
Syntriax 2023-11-27 11:00:34 +03:00
parent 08f981fa2b
commit e070dda3c8
1 changed files with 4 additions and 31 deletions

View File

@ -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<Texture2D>("Sprites/Pixel");
Sprite sprite = new Sprite() { Texture2D = texture2D };
gameObjectLeft = gameManager.InstantiateGameObject<GameObject>();
IGameObject gameObjectLeft = gameManager.InstantiateGameObject<GameObject>();
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<KeyboardInputsBehaviour>();
gameObjectLeft.BehaviourController.AddBehaviour<MovementBehaviour>(Keys.S, Keys.W, 200f);
gameObjectLeft.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>(Color.Gold, null, null, null).Assign(sprite);
gameObjectLeft.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(sprite);
gameObjectRight = gameManager.InstantiateGameObject<GameObject>();
IGameObject gameObjectRight = gameManager.InstantiateGameObject<GameObject>();
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<KeyboardInputsBehaviour>();
gameObjectRight.BehaviourController.AddBehaviour<MovementBehaviour>(Keys.Down, Keys.Up, 200f);
gameObjectRight.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>(Color.AliceBlue, null, null, null).Assign(sprite);
gameObjectRight.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().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);