예제 #1
0
 // Constructor.
 public MazeController(GameController game, int size)
 {
     this.game = game;
     cellsize = 10;
     this.walls = new List<GameObject>();
     this.ground = new Ground(game, size * cellsize, size * cellsize);
     Generate(size, size);
 }
예제 #2
0
        public MainPage()
        {
            InitializeComponent();
            game = new GameController(this);
            game.Run(this);
            mainMenu = new MainMenu(this);
            gameOver = new GameOver(this);
            gameWon = new Winner(this);

            this.Children.Add(mainMenu);
        }
예제 #3
0
파일: Ground.cs 프로젝트: reeselevine/proj2
 public Ground(GameController game, int width, int height)
 {
     this.game = game;
     Color color = Color.Black;
     Vector3 normal = new Vector3(0, 1, 0);
     vertices = Buffer.Vertex.New(game.GraphicsDevice, new[]
     {
         new VertexPositionNormalColor(new Vector3(0,0,0), normal, color),
         new VertexPositionNormalColor(new Vector3(0,0,height), normal, color),
         new VertexPositionNormalColor(new Vector3(width,0,height), normal, color),
         new VertexPositionNormalColor(new Vector3(0,0,0), normal, color),
         new VertexPositionNormalColor(new Vector3(width, 0, height), normal, color),
         new VertexPositionNormalColor(new Vector3(width, 0, 0), normal, color)
     });
     effect = game.Content.Load<Effect>("Phong");
     inputLayout = VertexInputLayout.FromBuffer(0, vertices);
 }
예제 #4
0
파일: Ghost.cs 프로젝트: reeselevine/proj2
        public Ghost(GameController game)
        {
            this.game = game;
            color = new Color(new Vector3(124, 0, 0), 0.05f);
            size = 2;
            height = 0.5f;
            seek = 0;
            delay = 240;
            Spawn();
            speed = .05f;
            direction = new Vector3(game.player.pos.X - pos.X, 0, game.player.pos.Z - pos.Z);
            UpdateVertices();

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.player.View,
                Projection = game.player.Projection,
                World = game.player.World,
                VertexColorEnabled = true
            };
        }
예제 #5
0
파일: Player.cs 프로젝트: reeselevine/proj2
 public Player(GameController game, int numLives)
 {
     this.game = game;
     type = GameObjectType.Player;
     Yaw = 0;
     Pitch = 0;
     yTarget = 1;
     scaleDown = .001f;
     collisionError = .2f;
     deltaError = .05f;
     prevY = 0f;
     ghostEncounters = numLives;
     invincible = false;
     invincibilityCounter = 0;
     invincibilityTimer = 120;
     //camera controller
     pos = new Vector3(5, 1, 5);
     currentTarget = new Vector3(30, 1, 30);
     View = Matrix.LookAtLH(pos, currentTarget, Vector3.UnitY);
     Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.01f, 1000.0f);
     World = Matrix.Identity;
     this.game = game;
 }
예제 #6
0
        public LightBeam(GameController game, float width, int height)
        {
            this.game = game;

            float xPos = (game.size - 1) * game.mazeController.cellsize;
            float zPos = (game.size - 1) * game.mazeController.cellsize;
            float offset = width;

            float adjust = game.mazeController.cellsize / 3;
            Color color = new Color(new Vector3(124, 124, 0), 0.01f);
            Vector3 frontBottomLeft = new Vector3(xPos + adjust, -1.0f, zPos + adjust);
            Vector3 frontTopLeft = new Vector3(xPos + adjust, height, zPos + adjust);
            Vector3 frontTopRight = new Vector3(xPos + offset - adjust, height, zPos + adjust);
            Vector3 frontBottomRight = new Vector3(xPos + offset - adjust, -1.0f, zPos + adjust);
            Vector3 backBottomLeft = new Vector3(xPos + adjust, -1.0f, zPos + offset - adjust);
            Vector3 backBottomRight = new Vector3(xPos + offset - adjust, -1.0f, zPos + offset - adjust);
            Vector3 backTopLeft = new Vector3(xPos + adjust, height, zPos + offset - adjust);
            Vector3 backTopRight = new Vector3(xPos + offset - adjust, height, zPos + offset - adjust);

            vertices = Buffer.Vertex.New(game.GraphicsDevice, new[]
            {
            new VertexPositionColor(frontBottomLeft, color), // Front
            new VertexPositionColor(frontTopLeft,color),
            new VertexPositionColor(frontTopRight, color),
            new VertexPositionColor(frontBottomLeft, color),
            new VertexPositionColor(frontTopRight, color),
            new VertexPositionColor(frontBottomRight, color),
            new VertexPositionColor(backBottomLeft, color), // BACK
            new VertexPositionColor(backTopRight, color),
            new VertexPositionColor(backTopLeft, color),
            new VertexPositionColor(backBottomLeft, color),
            new VertexPositionColor(backBottomRight, color),
            new VertexPositionColor(backTopRight, color),
            new VertexPositionColor(frontTopLeft, color), // Top
            new VertexPositionColor(backTopLeft, color),
            new VertexPositionColor(backTopRight, color),
            new VertexPositionColor(frontTopLeft, color),
            new VertexPositionColor(backTopRight, color),
            new VertexPositionColor(frontTopRight, color),
            new VertexPositionColor(frontBottomLeft, color), // Bottom
            new VertexPositionColor(backBottomRight, color),
            new VertexPositionColor(backBottomLeft, color),
            new VertexPositionColor(frontBottomLeft, color),
            new VertexPositionColor(frontBottomRight, color),
            new VertexPositionColor(backBottomRight, color),
            new VertexPositionColor(frontBottomLeft, color), // Left
            new VertexPositionColor(backBottomLeft, color),
            new VertexPositionColor(backTopLeft, color),
            new VertexPositionColor(frontBottomLeft, color),
            new VertexPositionColor(backTopLeft, color),
            new VertexPositionColor(frontTopLeft, color),
            new VertexPositionColor(frontBottomRight, color), // Right
            new VertexPositionColor(backTopRight, color),
            new VertexPositionColor(backBottomRight, color),
            new VertexPositionColor(frontBottomRight, color),
            new VertexPositionColor(frontTopRight, color),
            new VertexPositionColor(backTopRight, color),
                });

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.player.View,
                Projection = game.player.Projection,
                World = game.player.World,
                VertexColorEnabled = true
            };
        }