Пример #1
0
 public void Register(string key, Animation animation)
 {
     if (_animations.ContainsKey(key))
     {
         throw new InvalidOperationException("Animation key already registered.");
     }
     _animations.Add(key, animation);
 }
Пример #2
0
 public Tile(Tileset tileset, TileType type, Rectangle source, int tilesetIndex, Animation animation)
 {
     _tileset = tileset;
     _type = type;
     _source = source;
     _tilesetIndex = tilesetIndex;
     _animation = animation;
 }
Пример #3
0
 public void Play(string key)
 {
     if (key != null)
     {
         if (!_animations.ContainsKey(key))
         {
             throw new InvalidOperationException("Unknown animation");
         }
         _currentAnimation = _animations[key];
     }
 }