Ejemplo n.º 1
0
 private _2DSprite GetWallSprite(Wall pattern, WallStyle style, int rotation, bool down, WorldState world)
 {
     var _Sprite = new _2DSprite()
     {
         RenderMode = _2DBatchRenderMode.WALL
     };
     SPR sprite = null;
     SPR mask = null;
     switch (world.Zoom)
     {
         case WorldZoom.Far:
             sprite = pattern.Far;
             if (style != null) mask = (down) ? style.WallsDownFar : style.WallsUpFar;
             _Sprite.DestRect = DESTINATION_FAR[rotation];
             _Sprite.Depth = WallZBuffers[rotation+8];
             break;
         case WorldZoom.Medium:
             sprite = pattern.Medium;
             if (style != null) mask = (down) ? style.WallsDownMedium : style.WallsUpMedium;
             _Sprite.DestRect = DESTINATION_MED[rotation];
             _Sprite.Depth = WallZBuffers[rotation+4];
             break;
         case WorldZoom.Near:
             sprite = pattern.Near;
             if (style != null) mask = (down) ? style.WallsDownNear : style.WallsUpNear;
             _Sprite.DestRect = DESTINATION_NEAR[rotation];
             _Sprite.Depth = WallZBuffers[rotation];
             break;
         }
     if (sprite != null)
     {
         if (mask == null) mask = sprite;
         _Sprite.Pixel = world._2D.GetTexture(sprite.Frames[rotation]);
         _Sprite.Mask = world._2D.GetTexture(mask.Frames[rotation]);
         _Sprite.SrcRect = new Microsoft.Xna.Framework.Rectangle(0, 0, _Sprite.Pixel.Width, _Sprite.Pixel.Height);
     }
     return _Sprite;
 }