Blink.StateGame.LoadContent C# (CSharp) Method

LoadContent() public method

public LoadContent ( Microsoft.Xna.Framework.Content.ContentManager Content ) : void
Content Microsoft.Xna.Framework.Content.ContentManager
return void
        public void LoadContent(ContentManager Content)
        {
            Vector2 negPos = new Vector2(-100, -100);
            activePlayers = 0;
            if (playersInGame[0]) {
                players[0] = player1;
                activePlayers++;
            }
            else
                player1.active = false;
            if (playersInGame[1]) {
                players[1] = player2;
                activePlayers++;
            }
            else
                player2.active = false;
            if (playersInGame[2]) {
                players[2] = player3;
                activePlayers++;
            }
            else
                player3.active = false;
            if (playersInGame[3]) {
                players[3] = player4;
                activePlayers++;
            }
            else
                player4.active = false;

            Vector2 offset = new Vector2(-4, -4);
            Texture2D bar = Content.Load<Texture2D>("bar");
            Texture2D dust = Content.Load<Texture2D>("Dust_Trail");
            Texture2D dustPoof = Content.Load<Texture2D>("Dust_Poof");
            control_diagram = Content.Load<Texture2D>("controller");
            scores_bg = Content.Load<Texture2D>("scores");
            Texture2D powerup = Content.Load<Texture2D>("powerups");

            for(int i = 0; i < 4; i++)
            {
                if (players[i] != null && players[i].active)
                {
                    players[i].Initialize(Content.Load<Texture2D>(playerTexts[i]), negPos, screenSize, null, players, playerOffsets[playerCharNums[i]], bar, charWidths[playerCharNums[i]]);
                    players[i].moveFrames = charFrameData[playerCharNums[i],0];
                    players[i].idles = idleAnim[playerCharNums[i]];
                    players[i].frameLength = charFrameData[playerCharNums[i], 1];
                    players[i].armOffset = new Vector2(charFrameData[playerCharNums[i], 2], charFrameData[playerCharNums[i], 3]);
                    players[i].shoulder = new Vector2(charFrameData[playerCharNums[i], 4], charFrameData[playerCharNums[i], 5]);
                    players[i].throwWidth = charFrameData[playerCharNums[i], 6];
                    players[i].throwHeight = charFrameData[playerCharNums[i], 7];
                    players[i].flipOff = charFrameData[playerCharNums[i], 8];
                    players[i].flipOrigin = charFrameData[playerCharNums[i], 9];
                }
            }

            //Setup for common player resources
            foreach (PlayerClass p in players)
            {
                if (p != null)
                {
                    p.deadText = Content.Load<Texture2D>("spriteDead");

                    p.Death_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Death").CreateInstance();

                    p.Jump_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Jump").CreateInstance();

                    p.Blink_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Blink").CreateInstance();

                    p.Unblink_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Blink").CreateInstance();

                    p.dustEffect = dust;

                    p.dustPoof = dustPoof;

                    p.aniList = animations;

                }
            }

            Texture2D spearTex = Content.Load<Texture2D>("spearsprite");
            Texture2D indicator = Content.Load<Texture2D>("spearIndicator");

            spear1 = new SpearClass(player1, spearTex, indicator, screenSize, null, players);
            spear2 = new SpearClass(player2, spearTex, indicator, screenSize, null, players);
            spear3 = new SpearClass(player3, spearTex, indicator, screenSize, null, players);
            spear4 = new SpearClass(player4, spearTex, indicator, screenSize, null, players);

            //Setup for common spear resources
            Throw_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Throw");
            Hit_Player_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Player_Hit");
            Hit_Wall_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Wall_Hit");
            Stab_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Attack");
            foreach (SpearClass s in spears)
            {
                s.Throw_Sound = Throw_Sound.CreateInstance();
                s.Hit_Player_Sound = Hit_Player_Sound.CreateInstance();
                s.Hit_Wall_Sound = Hit_Wall_Sound.CreateInstance();
                s.Stab_Sound = Stab_Sound.CreateInstance();
            }

            StreamReader[] mapData = new StreamReader[5];
            for(int i = 0; i < 5; i++) {
                mapData[i] = File.OpenText("Content/MapData/"+maps.Maps()[i]+".map");
                mapObs[i] = new Map();
                mapObs[i].Initialize(Content.Load<Texture2D>("MapData/"+maps.Maps()[i]+"Color"), mapData[i].ReadToEnd(), 32, 50, 30, players, powerup);
            }
            font = Content.Load<SpriteFont>("miramo30");

            resetMap();
        }