private static Tuple <ObjectAction, EnemyObjectTemplate> SpawnOneDestructionSpriteImage( long startMilliseconds, long endMilliseconds, string childObjectTemplateName, string spriteName, bool isLast) { List <ObjectAction> destroyActions = new List <ObjectAction>(); destroyActions.Add(ObjectAction.Destroy()); destroyActions.Add(ObjectAction.DestroyParent()); ObjectAction destroySelfAction = ObjectAction.Condition( condition: BooleanExpression.GreaterThanOrEqualTo( leftSide: MathExpression.ParentVariable(elapsedTimeInMillisVariableName), rightSide: MathExpression.Constant(endMilliseconds)), action: isLast ? ObjectAction.Union(destroyActions) : ObjectAction.Destroy()); ObjectAction spawnChildAction = ObjectAction.SpawnChild( childXMillis: MathExpression.XMillis(), childYMillis: MathExpression.YMillis(), childObjectTemplateName: childObjectTemplateName, childInitialNumericVariables: null, childInitialBooleanVariables: null); ObjectAction delayedSpawnChildAction = ObjectAction.Condition( condition: BooleanExpression.GreaterThanOrEqualTo( leftSide: MathExpression.Variable(elapsedTimeInMillisVariableName), rightSide: MathExpression.Constant(startMilliseconds)), action: ObjectActionGenerator.DoOnce(spawnChildAction)); EnemyObjectTemplate template = EnemyObjectTemplate.Enemy( action: destroySelfAction, initialMilliHP: null, damageBoxes: null, collisionBoxes: null, spriteName: spriteName); return(new Tuple <ObjectAction, EnemyObjectTemplate>(delayedSpawnChildAction, template)); }