static T CreateWordEffect <T, U>(U effectData) where T : WordEffect where U : WordEffectData { if (typeof(T).Equals(typeof(TypeWriterEffect))) { TypeWriterEffect effect = new TypeWriterEffect(); effect.ConstructWordEffect(effectData); return((T)(object)effect); } else if (typeof(T).Equals(typeof(InstantDisplayAfterDurationEffect))) { InstantDisplayAfterDurationEffect effect = new InstantDisplayAfterDurationEffect(); effect.ConstructWordEffect(effectData); return((T)(object)effect); } else if (typeof(T).Equals(typeof(VibrationEffect))) { VibrationEffect effect = new VibrationEffect(); effect.ConstructWordEffect(effectData); return((T)(object)effect); } else { throw new Exception("try to create unimplemented word effect"); } }