void ApplySpeedFunction(TAE.Animation animation, List <int> speedFunction) { for (int i = 0; i < speedFunction.Count; i++) { int speedPoints = speedFunction[i]; float speedMultiplier = (float)Math.Round(speedPoints * QuantizedSpeed, 2); if (!SpeedEffects.ContainsKey(speedMultiplier)) { throw new KeyNotFoundException($"No speed effect with multiplier {speedMultiplier}"); } float startTime = Tools.SnapTimeTo30FPS(i * FrameDuration); float endTime = startTime + FrameDuration; // effect lasts only one frame animation.ApplyEffect(SpeedEffects[speedMultiplier], startTime, endTime); } }
//Effect Giving public void giveSpeedEffect(SpeedEffects effect) { currentSpeedEffectList.Add(effect); }