public PickupManager(Game game, SosEngine.Level level, GameComponentCollection gameComponents) : base(game)
 {
     spriteFrameCache = new SosEngine.SpriteFrameCache();
     for (int y = 0; y < level.Height; y++)
     {
         for (int x = 0; x < level.Width; x++)
         {
             int block = level.GetBlock("Pickups", x, y);
             if (block > 0)
             {
                 string spriteFrameName = GetSpriteFrameNameForBlock(block);
                 Pickup pickup          = new Pickup(game, spriteFrameName, block, x * 16, y * 16, animationDelay, 100, spriteFrameCache);
                 if (IsHiddenItem(block))
                 {
                     pickup.Visible = false;
                 }
                 if (IsAnimatedItem(block))
                 {
                     string spriteFrameName2 = GetSpriteFrameNameForBlock(block + 1);
                     pickup.AddFrame(spriteFrameName2, animationDelay);
                     pickup.AddFrame(GetSpriteFrameNameForBlock(block + 2), animationDelay);
                     pickup.AddFrame(GetSpriteFrameNameForBlock(block + 3), animationDelay);
                 }
                 pickup.DrawOffsetX = 0;
                 gameComponents.Add(pickup);
                 AddSprite(pickup);
             }
         }
     }
 }
Exemple #2
0
 public Pickup(Game game, string spriteFrameName, int block, int x, int y, int delay, int score, SosEngine.SpriteFrameCache spriteFrameCache)
     : base(game, spriteFrameName, delay, spriteFrameCache)
 {
     this.Position = new Vector2(x, y);
     this.Block    = block;
     this.Score    = score;
 }