/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load <SpriteFont>("Time"); Texture2D gras = Content.Load <Texture2D>("Gras"); Texture2D hecke = Content.Load <Texture2D>("Hecke2"); spieler = Content.Load <Model>("Teapot_red"); arrow = Content.Load <Model>("Arrow"); hintArrow = Content.Load <Model>("HintArrow"); map = new Mazemap(2); maze = new MazeConstructor(this, hecke, map, 8, 5); floor = new MazeFloor(this, gras, 5, map.MazeSize, map.MazeSize); teekanne = new Spieler(this, spieler) { Position = new Vector3(map.AnfangsFeld.X + 2.5f, 4, map.AnfangsFeld.Y * 5 + 2.5f) }; teekanne.Scale = new Vector3(0.015f); kompass = new Kompass(this, arrow, teekanne) { Scale = new Vector3(0.15f) }; hint = new Hint(this, hintArrow, teekanne, map.ZielFeld) { Scale = new Vector3(0.2f) }; camera = new ArcBallCamera(this, teekanne); timer = new Timer(this, font); }
/** * Diese Methode erzeugt das Labyrinth */ private void CreateMaze(Mazemap map) { for (int i = 0; i < map.Part.Length; i++) { WandLinks(-1, i); WandOben(i, -1); WandRechts(map.Part.Length, i); if (i != map.ZielFeld.X) { WandUnten(i, map.Part.Length); } } for (int i = 0; i < map.Part.Length; i++) { for (int j = 0; j < map.Part.Length - 1; j++) { switch (map.Part[i][j]) { case MazePart.GangObenUnten: GangObenUnten(i, j); break; case MazePart.GangRechtsLinks: GangRechtsLinks(i, j); break; case MazePart.Kreuzung: break; case MazePart.KurveObenLinks: KurveObenLinks(i, j); break; case MazePart.KurveObenRechts: KurveObenRechts(i, j); break; case MazePart.KurveUntenLinks: KurveUntenLinks(i, j); break; case MazePart.KurveUntenRechts: KurveUntenRechts(i, j); break; case MazePart.SackgasseLinks: SackgasseLinks(i, j); break; case MazePart.SackgasseOben: SackgasseOben(i, j); break; case MazePart.SackgasseRechts: SackgasseRechts(i, j); break; case MazePart.SackgasseUnten: SackgasseUnten(i, j); break; case MazePart.TKreuzungLinks: TKreuzungLinks(i, j); break; case MazePart.TKreuzungOben: TKreuzungOben(i, j); break; case MazePart.TKreuzungRechts: TKreuzungRechts(i, j); break; case MazePart.TKreuzungUnten: TKreuzungUnten(i, j); break; case MazePart.Wand: Wand(i, j); break; } } } vertexBufferWaende = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionTexture), VerticesWaende.Length, BufferUsage.WriteOnly); vertexBufferWaende.SetData <VertexPositionTexture>(VerticesWaende); indexBufferWaende = new IndexBuffer(game.GraphicsDevice, typeof(short), IndicesWaende.Length, BufferUsage.WriteOnly); indexBufferWaende.SetData <short>(IndicesWaende); }
public MazeConstructor(Game game, Texture2D textureWand, Mazemap map, int height, int step) { vertexListWaende = new List <VertexPositionTexture>(); indexListWaende = new List <short>(); BoundingBoxes = new List <BoundingBox>(); this.game = game; this.height = height; this.step = step; this.hecke = textureWand; wandEffect = new BasicEffect(game.GraphicsDevice); this.map = map; CreateMaze(map); }