Exemplo n.º 1
0
        public ActorManager(GraphicsDeviceManager _graphics, GraphicsDevice _device, InputManager _input)
        {
            this.Graphics = _graphics;
            this.Device = _device;
            this.Input = _input;

            AIList = new List<AI>();
            PieceList = new List<Piece>();

            FriendlyCollidables = new List<Collidable>();
            FriendlyProjectiles = new List<Collidable>();
            EnemyCollidables = new List<Collidable>();
            EnemyProjectiles = new List<Collidable>();

            PlayerControlsList = new List<PlayerControls>();
            Collisions = new CollisionManager(this);

            int gWidth = CollisionManager.GRID_WIDTH;
            int gHeight = CollisionManager.GRID_HEIGHT;

            BorderWidth = (gWidth + 2) / gWidth * Graphics.PreferredBackBufferWidth;
            BorderHeight = (gHeight + 2) / gHeight * Graphics.PreferredBackBufferHeight;

            Data = new ManagerData(Device);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     input = new InputManager();
     Manager = new ActorManager(graphics, GraphicsDevice, input);
     Manager.NewPlayer(new Vector2(screenWidth/2, screenHeight/2));
     base.Initialize();
 }
Exemplo n.º 3
0
 private void UpdateMovementInput(InputManager input)
 {
     float dY = 0;
     float dX = 0;
     if (input.isPressed(Up))
         dY -= 1;
     if (input.isPressed(Down))
         dY += 1;
     if (input.isPressed(Left))
         dX -= 1;
     if (input.isPressed(Right))
         dX += 1;
     if (dX == 0 && dY == 0)
         Player.Stop();
     else
         Player.Go();
     Player.SetHeading(Math.Atan2(dY, dX));
 }
Exemplo n.º 4
0
 private void UpdateShootingInput(InputManager input)
 {
     if (input.isPressed(Shoot))
         Player.Shoot();
     else
         Player.HoldFire();
 }
Exemplo n.º 5
0
 public void UpdatePlayer(InputManager input)
 {
     UpdateMovementInput(input);
     UpdateShootingInput(input);
 }