public Game(Random random, int left, int top, String mazeFileName) { this.left = left; this.top = top; this.maze = Maze.Load(left, top, mazeFileName); this.player = this.maze.CreatePlayer(random, BACKGROUND); }
protected override void Initialize() { player = new Player(new Vector3(0, 0, 5)); worldMatrix = Matrix.Identity; viewMatrix = Matrix.CreateLookAt(player.Position, player.Position + player.Camera.View, player.Camera.Up); projectionMatrix = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45), (float) GraphicsDevice.Viewport.Width/ (float) GraphicsDevice.Viewport.Height, 1.0f, 100.0f); graphics.PreferMultiSampling = true; base.Initialize(); effect.CurrentTechnique = effect.Techniques["AmbientDiffuseLight"]; effect.Parameters["lightPosition"].SetValue(new Vector4(10, 0, 0, 1)); effect.Parameters["colorMap"].SetValue(colorMap); effect.Parameters["normalMap"].SetValue(normalMap); effect.Parameters["eyePosition"].SetValue(new Vector4(player.Position.X, player.Position.Y, player.Position.Z, 1)); objects = new List<Primitive>(); // objects.Add(new Cube(graphics.GraphicsDevice, effect, new Vector3(0,0,0), 1)); //objects.Add(new Maze()); this.oldKeyboardState = Keyboard.GetState(); this.oldMouseState = Mouse.GetState(); }
private void Reload() { _player.Dispose(); _player = null; _currentMaze.Dispose(); _currentMaze = null; CreateAll(); }
private void CreateAll() { // Create out Maze, which is the entire "world" the player will interact with. _currentMaze = new FullMaze(this, Constants.Maze.Width, Constants.Maze.Height); _currentMaze.Initialize(); // Initialize the player, informing it of it's starting point, somewhere within the maze, as the randomly generated maze tells us. _player = new Player(this, _currentMaze.StartPosition); _player.Initialize(); //_oldPlayerPosition = _player.Position; }
private void Reload(GameTime time) { _player.Dispose(); _player = null; _currentMaze.Dispose(); _currentMaze = null; CreateAll(time); }