Exemple #1
0
    // Fetch instruction
    protected virtual void DemoUpdate()
    {
        if (newDemoImplemented)
        {
            InstructionBase instruction = null;

            // Step by step activated by pausing, and step requested
            if (userPausedTask && demoManager.PlayerMove)
            {
                demoManager.PlayerMove = false;
                instruction            = demoManager.GetStep();

                bool increment = demoManager.PlayerIncremented;
                PerformInstruction(instruction, increment);
            }
            else if (!userPausedTask && demoManager.HasInstructions()) // Demo mode
            {
                // First check if user test setup is complete
                if (!WaitingForSupportToFinish())//waitForSupportToComplete == 0)
                {
                    instruction = demoManager.GetInstruction();
                    //Debug.Log("Current: " + demoManager.CurrentInstructionNr + ", Actual: " + instruction.InstructionNr);

                    PerformInstruction(instruction, true);
                    demoManager.IncrementToNextInstruction();
                }
            }

            // Debugging
            if (instruction != null && prevInstruction != instruction.Instruction)
            {
                prevInstruction = instruction.DebugInfo();
                Debug.Log(instruction.DebugInfo());

                if (useDebugText && debugText != null)
                {
                    if (deleteWhenReached <= 0)
                    {
                        debugText.text    = instruction.DebugInfo();
                        deleteWhenReached = debugLineNumbers;
                    }
                    else
                    {
                        debugText.text += "\n" + instruction.DebugInfo();
                    }

                    deleteWhenReached--;
                }
            }
        }
    }