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