public static AnimatedKeyframeViewModel FromSave(AnimationReferenceSave save) { AnimatedKeyframeViewModel toReturn = new AnimatedKeyframeViewModel(); toReturn.AnimationName = save.Name; toReturn.Time = save.Time; // There's no easing/interpolation supported for animation references return toReturn; }
public AnimationReferenceSave ToAnimationReferenceSave() { AnimationReferenceSave toReturn = new AnimationReferenceSave(); if(string.IsNullOrEmpty(AnimationName)) { throw new InvalidOperationException("Could not convert this to an AnimationReference because it doesn't have a valid Animation name"); } toReturn.Name = this.AnimationName; toReturn.Time = this.Time; return toReturn; }
private static void CreateInstructionForSubAnimation(ICodeBlock currentBlock, AnimationReferenceSave animationReferenceSave, AbsoluteOrRelative absoluteOrRelative, AnimationSave parentAnimation) { currentBlock = currentBlock.Block(); //var instruction = new FlatRedBall.Instructions.DelegateInstruction(() => //FlatRedBall.Instructions.InstructionManager.Instructions.AddRange(ClickableBushInstance.GrowAnimation)); //instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + asdf; //yield return instruction; string animationName = animationReferenceSave.PropertyNameInCode(); //animationReferenceSave. FlatRedBall.IO.FileManager.RemovePath(animationReferenceSave.Name) + "Animation"; if(absoluteOrRelative == AbsoluteOrRelative.Relative) { animationName += "Relative"; } currentBlock.Line($"var instruction = new FlatRedBall.Instructions.DelegateInstruction(()=>{animationName}.Play({parentAnimation.PropertyNameInCode()}));"); currentBlock.Line("instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + " + ToFloatString(animationReferenceSave.Time) + ";"); currentBlock.Line("yield return instruction;"); currentBlock = currentBlock.End(); }