Пример #1
0
        public override void Pause(FlatRedBall.Instructions.InstructionList instructions)
        {
            FlatRedBall.Instructions.Pause.EmitterUnpauseInstruction instruction =
                new FlatRedBall.Instructions.Pause.EmitterUnpauseInstruction(this);

            instruction.Stop(this);

            instructions.Add(instruction);
        }
Пример #2
0
        public InstructionList Clone()
        {
            InstructionList clone = new InstructionList();

            foreach (Instruction i in this)
            {
                clone.Add(i.Clone());
            }
            return(clone);
        }
Пример #3
0
 public void FillInstructionList(object target, double currentTime, InstructionList listToFill)
 {
     foreach (InstructionBlueprint template in this)
     {
         if (template.IsInitialized)
         {
             listToFill.Add(template.BuildInstruction(target, currentTime));
         }
     }
 }
Пример #4
0
        public static void PauseEngine(bool storeUnpauseInstructions)
        {
            if (mUnpauseInstructions.Count != 0)
            {
                throw new System.InvalidOperationException(
                          "Can't execute pause since there are already instructions in the Unpause InstructionList." +
                          " Are you causing PauseEngine twice in a row?" +
                          " Each PauseEngine method must be followed by an UnpauseEngine before PauseEngine can be called again.");
            }
            // When the engine pauses, each manager stops
            // all activity and fills the unpauseInstructions
            // with instructions that are executed to restart activity.

            // Turn off sorting so we don't sort over and over and over...
            // Looks like we never need to turn this back on.
            mUnpauseInstructions.SortOnAdd = false;

            SpriteManager.Pause(mUnpauseInstructions);

            ShapeManager.Pause(mUnpauseInstructions);

#if SILVERLIGHT
            throw new NotImplementedException();
#else
            TextManager.Pause(mUnpauseInstructions);
#endif

            InstructionListUnpause instructions = new InstructionListUnpause(mInstructions);
            mInstructions.Clear();
            mUnpauseInstructions.Add(instructions);

            if (!storeUnpauseInstructions)
            {
                mUnpauseInstructions.Clear();
            }

            // ... now do one sort at the end to make sure all is sorted properly
            // Actually, no, don't sort, it's not necessary!  We're going to execute
            // everything anyway.
            //mUnpauseInstructions.Sort((a, b) => a.TimeToExecute.CompareTo(b));
        }
Пример #5
0
 /// <summary>
 /// Adds the argument instruction to the InstructionManager, to be executed when its time is reached.
 /// </summary>
 /// <param name="instruction">The instruction to remove</param>
 public static void Add(Instruction instruction)
 {
     mInstructions.Add(instruction);
 }