Example #1
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     GL.Enable(EnableCap.Texture2D);
     _textures[0] = new TextureLoader().LoadTexture("wood.jpg");
     _textures[1] = new TextureLoader().LoadTexture("water.jpeg");
     _textures[2] = new TextureLoader().LoadTexture("persKover1.png");
     _textures[3] = new TextureLoader().LoadTexture("grass.jpg");
     _textures[4] = new TextureLoader().LoadTexture("dog1.png");
     _textures[5] = new TextureLoader().LoadTexture("fireball2.png");
     _textures[6] = new TextureLoader().LoadTexture("dust1.png");
     _textures[7] = new TextureLoader().LoadTexture("Cancer1.png");
     _textures[8] = new TextureLoader().LoadTexture("portal1.png");
     roomDrawer = new RoomDrawer(_textures);
     playerDrawer = new PlayerDrawer(_textures);
 }
Example #2
0
        public void Draw(Room room)
        {
            GL.BindTexture(TextureTarget.Texture2D, _textures[room.Texture]);

            new RectangleDrawer().Draw(room.Form);

            var borderDrawer = new RoomBorderDrawer(_textures);

            borderDrawer.Draw(room, room.Border);

            foreach (var t in room.Players)
            {
                var playerDrawer = new PlayerDrawer(_textures);
                playerDrawer.Draw(t);
            }

            foreach (var t in room.Obstacles)
            {
                var obsDrawer = new ObstacleDrawer(_textures);
                obsDrawer.Draw(room, t);
            }

            foreach (var t in room.Enemies)
            {
                var enemyDrawer = new EnemyDrawer(_textures);
                enemyDrawer.Draw(t);
            }

            foreach (var t in room.Shots)
            {
                var shotDrawer = new ShotDrawer(_textures);
                shotDrawer.Draw(t);
            }

            if (room is BossRoom)
            {
                var bRoom            = room as BossRoom;
                var finishZoneDrawer = new FinishZoneDrawer(_textures);
                if (bRoom.FinishZone.IsActive)
                {
                    finishZoneDrawer.Draw(bRoom.FinishZone);
                }
            }

            foreach (var t in room.Items)
            {
                if (t.IsAvailable)
                {
                    var itemDrawer = new ItemDrawer(_textures);
                    itemDrawer.Draw(t);
                }
            }

            var doorDrawer = new DoorDrawer(_textures);

            if (room.TopDoor != null)
            {
                doorDrawer.Draw(room.TopDoor);
            }
            if (room.BotDoor != null)
            {
                doorDrawer.Draw(room.BotDoor);
            }
            if (room.LeftDoor != null)
            {
                doorDrawer.Draw(room.LeftDoor);
            }
            if (room.RightDoor != null)
            {
                doorDrawer.Draw(room.RightDoor);
            }
        }