示例#1
0
 private Tileset(string name, int id)
 {
     uint[][] t = RenderUtils.LoadBitmapSheet(TilesetPath + name + TilesetExtension, Overworld.Tile_NumPixelsX, Overworld.Tile_NumPixelsY);
     Tiles = new Tile[t.Length];
     for (int i = 0; i < t.Length; i++)
     {
         Tiles[i] = new Tile(this, t[i]);
     }
     TileAnimation[] a = TileAnimation.LoadOrGet(id);
     if (a != null)
     {
         _animations = new TileAnimationLive[a.Length];
         for (int i = 0; i < a.Length; i++)
         {
             _animations[i] = new TileAnimationLive(this, a[i]);
         }
     }
 }
示例#2
0
        public void Tick()
        {
            TileAnimation anim = _anim;
            int           c    = (_counter + 1) % anim.Duration;

            _counter = c;
            for (int f = 0; f < anim.Frames.Length; f++)
            {
                TileAnimation.Frame frame = anim.Frames[f];
                Tileset.Tile        tile  = _tileset.Tiles[frame.TilesetTile];
                for (int s = frame.Stops.Length - 1; s >= 0; s--)
                {
                    TileAnimation.Frame.Stop stop = frame.Stops[s];
                    if (stop.Time <= c)
                    {
                        tile.AnimBitmap = anim.Sheet[stop.SheetTile];
                        goto bottom;
                    }
                }
                tile.AnimBitmap = null;
bottom:
                ;
            }
        }
示例#3
0
 public TileAnimationLive(Tileset tileset, TileAnimation anim)
 {
     _tileset = tileset;
     _anim    = anim;
 }