示例#1
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();
 }
        public CollisionManager(ActorManager _actorManager)
        {
            Device = _actorManager.Device;
            Manager = _actorManager;
            Font = _actorManager.Font;
            GraphicsDeviceManager Graphics = _actorManager.Graphics;
            BorderWidth = Graphics.PreferredBackBufferWidth;
            BorderHeight = Graphics.PreferredBackBufferHeight;
            ZoneWidth = BorderWidth / (GRID_WIDTH-2);
            ZoneHeight = BorderHeight / (GRID_HEIGHT-2);

            FriendlyCollidables = new List<Collidable>[GRID_WIDTH, GRID_HEIGHT];
            FriendlyProjectiles = new List<Collidable>[GRID_WIDTH, GRID_HEIGHT];
            EnemyCollidables = new List<Collidable>[GRID_WIDTH, GRID_HEIGHT];
            EnemyProjectiles = new List<Collidable>[GRID_WIDTH, GRID_HEIGHT];

            CreateEmptyGrids();
            ZoneSprite = CreateZoneSprite();
        }