public Player(PlatformGame game, string name, CustomSpriteSheetDefinition spriteSheetDefinition)
        {
            this.game = game;

            HorizontalDirection = HorizontalDirection.None;

            BoundingBox = new CustomBoundingBox();

            Name = name;

            Score = new Score();
            Team = new NeutralTeam();

            spriteSheetInstance = new CustomSpriteSheetInstance(spriteSheetDefinition, 3);
        }
 public CustomSpriteSheetInstance(CustomSpriteSheetDefinition spriteSheetDefinition, int framesToSkip)
 {
     SpriteSheetDefinition = spriteSheetDefinition;
     FramesToSkip = framesToSkip;
 }
        public void LoadContent(ContentManager content)
        {
            pixelForLines = new Texture2D(game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            pixelForLines.SetData(new[] { Color.White });
            HudText = content.Load<Texture2D>("hud");
            HudMsg = content.Load<Texture2D>("hud-msg");
            SpawnSound = content.Load<SoundEffect>("Sound/testsound");
            ShotSound = content.Load<SoundEffect>("Sound/shot");
            DefaultFont = content.Load<SpriteFont>("spriteFont1");

            using(var sr = new StreamReader(content.RootDirectory + @"\bzDat.yml"))
            {
                gameData = new YamlSerializer<GameData>().Deserialize(sr);
            }

            foreach (var sheet in gameData.Spritesheets)
            {
                //TODO BDM: Clean up very brittle and hacky code!!!
                var anim = sheet.Animations.First();
                var rect = new Rectangle(0, 0, sheet.TileSize, sheet.TileSize);
                var length = (sheet.Animations.First().EndX - sheet.Animations.First().StartX + 1);
                var def = new CustomSpriteSheetDefinition(content, sheet.SourceFile, rect, length);
                def.Y = anim.Y;
                CharacterSheets.Add(def);
            }

            foreach (var bgToLoad in gameData.Levels.SelectMany(l => l.Parallax).Select(p => p.SourceFile).Distinct())
            {
                DynamicTextures.Add(bgToLoad, content.Load<Texture2D>(bgToLoad));
            }

            foreach (var tilesetToLoad in gameData.Tilesets.Select(t => t.SourceFile).Distinct())
            {
                DynamicTextures.Add(tilesetToLoad, content.Load<Texture2D>(tilesetToLoad));
            }

            // TODO BDM: Fix
            //BulletImpactSpriteSheet = new CustomSpriteSheetDefinition(content, "Weapons/bullet-impact", new Rectangle(0, 0, 42, 29), 6);
        }
 public CustomSpriteSheetInstance(CustomSpriteSheetDefinition spriteSheetDefinition, int framesToSkip)
 {
     SpriteSheetDefinition = spriteSheetDefinition;
     FramesToSkip          = framesToSkip;
 }