Beispiel #1
0
        public static void Init(ContentManager Content)
        {
            content = Content;

            Font = content.Load <SpriteFont>("Fonts/Font");

            Cell            = content.Load <Texture2D>("Sprites/CellBackground");
            GameOverScreen  = content.Load <Texture2D>("Sprites/Gameover");
            MenuButton      = content.Load <Texture2D>("Sprites/MenuButton");
            PlayButton      = content.Load <Texture2D>("Sprites/PlayButton");
            Destroyer       = content.Load <Texture2D>("Sprites/Destroyer");
            FieldBackground = content.Load <Texture2D>("Sprites/FieldBackground");

            BombSound  = content.Load <SoundEffect>("Sound/bomb");
            MatchSound = content.Load <SoundEffect>("Sound/match");
            ClickSound = content.Load <SoundEffect>("Sound/click");
            LineSound  = content.Load <SoundEffect>("Sound/bonusline");
            TickSound  = content.Load <SoundEffect>("Sound/tick");

            elementsDict.Add(ShapeType.Empty,
                             Enumerable.Repeat(content.Load <Texture2D>("Sprites/BlankCell"), 4).ToArray());

            var memberInfos = typeof(ShapeType).GetMembers(BindingFlags.Public | BindingFlags.Static);

            for (var i = 1; i < memberInfos.Length; i++)
            {
                var type = (ShapeType)Enum.Parse(typeof(ShapeType), memberInfos[i].Name);
                elementsDict.Add(type, buildTexturesByType(type));
            }

            BackgroundSound = content.Load <SoundEffect>("Sound/marimba");
            var backSong = BackgroundSound.CreateInstance();

            backSong.IsLooped = true;
            backSong.Play();
        }