private static void CreateInstructionForSubAnimation(ICodeBlock currentBlock, AnimationReferenceSave animationReferenceSave, AbsoluteOrRelative absoluteOrRelative, AnimationSave parentAnimation, StateCodeGeneratorContext context) { 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; var isReferencingMissingInstance = !string.IsNullOrEmpty(animationReferenceSave.SourceObject) && context.Element.GetInstance(animationReferenceSave.SourceObject) == null; ////////////////Early Out/////////////// if (isReferencingMissingInstance) { currentBlock.Line($"// This animation references a missing instance named {animationReferenceSave.SourceObject}"); return; } /////////////End Early Out///////////// 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(); }
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(); }