Esempio n. 1
0
 public Room(RectangleF form, int texture)
 {
     _form = form;
     _texture = texture;
     //_obstacles.Add(new Obstacle(new RectangleF(form.Left + 0.84f, form.Bottom + 1.13f, 0.32f,
     //    -0.26f), 1));
     _border = new RoomBorder(0.15f, 0.15f, 0);
     _finishZone = new FinishZone(new RectangleF(form.Left + 0.85f, form.Bottom + 0.7f, 0.3f,
         -0.3f), 8);
     //_enemies.Add(new Enemy(form.Left + 0.5f, form.Bottom + 0.5f, 630.0f/2000, 371.0f/2000, 0.15f/60, 1000, 4));
 }
Esempio n. 2
0
        public void Draw(Room room, RoomBorder roomBorder)
        {
            GL.BindTexture(TextureTarget.Texture2D, _textures[roomBorder.Texture]);

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Left, room.Form.Top);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Right, room.Form.Top);
            GL.End();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Right, room.Form.Bottom);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Right, room.Form.Top);
            GL.End();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Right, room.Form.Bottom);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Left, room.Form.Bottom);
            GL.End();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Left, room.Form.Bottom);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Left, room.Form.Top);
            GL.End();
        }
Esempio n. 3
0
        public void Draw(Room room, RoomBorder roomBorder)
        {
            GL.BindTexture(TextureTarget.Texture2D, _textures[roomBorder.Texture]);

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Left, room.Form.Top);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Right, room.Form.Top);
            GL.End();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Right, room.Form.Bottom);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Right, room.Form.Top);
            GL.End();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Right, room.Form.Bottom);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Right - roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Left, room.Form.Bottom);
            GL.End();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex2(room.Form.Left, room.Form.Bottom);
            GL.TexCoord2(0, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Bottom + roomBorder.Height);
            GL.TexCoord2(1, 1);
            GL.Vertex2(room.Form.Left + roomBorder.Width, room.Form.Top - roomBorder.Height);
            GL.TexCoord2(1, 0);
            GL.Vertex2(room.Form.Left, room.Form.Top);
            GL.End();
        }
Esempio n. 4
0
        public Room(string fileName)
        {
            var strings = File.ReadAllLines("Rooms/" + fileName);

            _form = new RectangleF(float.Parse(strings[0]), float.Parse(strings[1]),
                                   float.Parse(strings[2]), float.Parse(strings[3]));
            _border = new RoomBorder(float.Parse(strings[4]), float.Parse(strings[5]),
                                     int.Parse(strings[6]));
            _texture = int.Parse(strings[7]);
            for (var i = 0; i < int.Parse(strings[8]); i++)
            {
                var x     = float.Parse(strings[9 + 3 * i]);
                var y     = float.Parse(strings[10 + 3 * i]);
                var name  = strings[11 + 3 * i];
                var enemy = new Enemy(x, y, name);
                _enemies.Add(enemy);
                _enemyControllers[enemy] = new DefaultEnemyController(enemy, this);
            }
        }
Esempio n. 5
0
 public Room(RectangleF form, int texture)
 {
     _form    = form;
     _texture = texture;
     _border  = new RoomBorder(0.15f, 0.15f, 0);
 }