Exemplo n.º 1
0
        public void LoadContent(ContentManager content, string map_level)
        {
            this.content = new ContentManager(content.ServiceProvider, "Content");
            attributes = new List<List<string>>();
            contents = new List<List<string>>();

            fileManager = new FileManager();

            fileManager.LoadContent(map_level, attributes, contents);

            tiles = new List<Texture2D>();
            tiles.Add(content.Load<Texture2D>(@"Tiles/GrassTile"));
            tiles.Add(content.Load<Texture2D>(@"Tiles/BrickWall"));
            tiles.Add(content.Load<Texture2D>(@"Tiles/Rock"));
            tileMap = new List<List<string>>();
            row = new List<string>();

            for (int i = 0; i < contents.Count; i++)
            {
                for (int j = 0; j < contents[i].Count; j++)
                {
                    row.Add(contents[i][j]);
                }
                tileMap.Add(row);
                row = new List<string>();
            }

            background_music = this.content.Load<Song>(@"Audios/audio01");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = sound_volume;
        }
Exemplo n.º 2
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content, InputManager input)
        {
            base.LoadContent(content, input);
            hit = false;
            fileManager = new FileManager();
            moveAnimation = new SpriteSheetAnimation();
            Vector2 temptFrames = Vector2.Zero;

            fileManager.LoadContent("Load/Enemy.cme", attributes, contents);
            for (int i = 0; i < attributes.Count; i++)
            {
                for (int j = 0; j < attributes[i].Count; j++)
                {
                    switch (attributes[i][j])
                    {
                        case "Health":
                            health = int.Parse(contents[i][j]);
                            max_health = health;
                            break;
                        case "Frames":
                            string[] frames = contents[i][j].Split(' ');
                            temptFrames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                            break;
                        case "Image":
                            image = this.content.Load<Texture2D>(contents[i][j]);
                            break;
                        case "Position":
                            frames = contents[i][j].Split(' ');
                            position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                            break;
                    }
                }
            }

            moveAnimation.Frames = temptFrames;
            moveAnimation.LoadContent(content, image, "", position);
            moveAnimation.Scale = 1f;
            enemy_img = this.content.Load<Texture2D>(@"enemy");
        }
Exemplo n.º 3
0
        public void LoadContent(ContentManager content, string file)
        {
            this.content = new ContentManager(content.ServiceProvider, "Content");
            attributes = new List<List<string>>();
            contents = new List<List<string>>();

            fileManager = new FileManager();

            fileManager.LoadContent(file, attributes, contents);

            collisionMap = new List<List<string>>();
            row = new List<string>();

            for (int i = 0; i < contents.Count; i++)
            {
                for (int j = 0; j < contents[i].Count; j++)
                {
                    row.Add(contents[i][j]);
                }
                collisionMap.Add(row);
                row = new List<string>();
            }
        }
Exemplo n.º 4
0
        //Sprite Sheet loading. Page 41
        public override void LoadContent(ContentManager content, InputManager inputManager)
        {
            base.LoadContent(content, inputManager);
            fileManager = new FileManager();
            moveAnimation = new SpriteSheetAnimation();
            Vector2 temptFrames = Vector2.Zero;

            fileManager.LoadContent("Load/Player.cme", attributes, contents);
            for (int i = 0; i < attributes.Count; i++)
            {
                for (int j = 0; j < attributes[i].Count; j++)
                {
                    switch (attributes[i][j])
                    {
                        case "Health":
                            health = int.Parse(contents[i][j]);
                            max_health = health;
                            break;
                        case "Frames":
                            string[] frames = contents[i][j].Split(' ');
                            temptFrames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                            break;
                        case "Image":
                            image = this.content.Load<Texture2D>(contents[i][j]);
                            break;
                        case "Position":
                            frames = contents[i][j].Split(' ');
                            position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                            break;
                    }
                }
            }

            bulletLoad = new List<Bullet>();
            bullet_img = this.content.Load<Texture2D>(@"bullet");

            sound_volume = 0.10f;

            moveAnimation.Frames = temptFrames;
            moveAnimation.LoadContent(content, image, "", position);

            shoot_sound = this.content.Load<SoundEffect>(@"Audios/shoot_audio");
            player_img = this.content.Load<Texture2D>(@"player_sprite");
        }
Exemplo n.º 5
0
 public void UnloadContent()
 {
     content.Unload();
     fileManager = null;
 }
Exemplo n.º 6
0
 public void UnloadContent()
 {
     content.Unload();
     fileManager = null;
     background_music = null;
 }