using System;
using System.Collections.Generic;
class AnimationTrack<T> where T : struct {
public void Start() { Console.WriteLine("start:" + typeof(T)); }
}
interface IAnimationTrack {
void Start();
}
class AnimationTrackAdapter<T> : IAnimationTrack where T : struct {
public AnimationTrack<T> Track;
public AnimationTrackAdapter(AnimationTrack<T> t) { Track = t; }
public void Start() { Track.Start(); }
}
class AnimationClip {
List<IAnimationTrack> tracks = new List<IAnimationTrack>();
public void Add(IAnimationTrack t) { tracks.Add(t); }
public void Start() { foreach (IAnimationTrack t in tracks) { t.Start(); } }
}
class Program {
public static AnimationTrackAdapter<T> Wrap<T>(AnimationTrack<T> t) where T : struct {
return new AnimationTrackAdapter<T>(t);
}
static void Main(string[] args) {
AnimationClip c = new AnimationClip();
c.Add(Wrap(new AnimationTrack<int>()));
c.Add(Wrap(new AnimationTrack<float>()));
c.Start();
}
}