Beispiel #1
0
    // Start is called before the first frame update
    protected override void Awake()
    {
        var step1 = new TutorialStep();

        AddStep(step1);
        step1.Description = "There's still some things you should know!" +
                            "\n\nBefore we get st-st-arted, drag two INPUT instructions into the Solution Window.";
        step1.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("SolutionWindow");
        }
            );
        step1.AddCompletionCondition(
            () => {
            FocusInstruction(OpCode.INPUT);
            var container = FindObjectOfType <InstructionContainer>();
            int numInPlay = container.Count;
            return((numInPlay > 2) && DragNDrop.CurrDragInstruction == null);
        }
            );

        var step2 = new TutorialStep();

        AddStep(step2);
        step2.Description = "Fantastic! Did you know that Computrons know how to step?" +
                            "\n\nHit that big blue step button to make Computron execute a single instuction";
        step2.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("StepButton");
        }
            );

        step2.AddCompletionCondition(
            () => {
            var actor = FindObjectOfType <Actor>();
            return(actor.step == true);
        }
            );



        var step3 = new TutorialStep();

        AddStep(step3);
        step3.Description = "Go ahead and give the button another thwak";
        step3.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("StepButton");
            var actor = FindObjectOfType <Actor>();
            //f****n cheat
            actor.step = false;
        }
            );
        step3.AddCompletionCondition(
            () => {
            var actor = FindObjectOfType <Actor>();
            return(actor.step == true);
        }
            );
        step3.AddEndBehavior(
            () => {
        }
            );

        var step4 = new TutorialStep();

        AddStep(step4);
        step4.Description = "One more fun fact, Computrons love to be helpful. " +
                            "\n\nClick on yours during any level and receive a fun fact! Give it a try now!";
        step4.AddBeginBehavior(
            () => {
            TextBoxController.gameObject.transform.position += new Vector3(5, 0);
        }
            );
        step4.AddCompletionCondition(
            () => {
            return(GameObject.FindGameObjectWithTag("HintBox") != null);
        }
            );
        step4.AddEndBehavior(
            () => {
            TextBoxController.gameObject.transform.position -= new Vector3(5, 0);
        }
            );
    }
Beispiel #2
0
    protected override void Awake()
    {
        TutorialStep step1 = new TutorialStep();

        AddStep(step1);
        step1.Description = "Computron doesn't have legs, but it can still jump! " +
                            "\nDrag a jump instruction into the solution window.";

        step1.AddBeginBehavior(
            () => {
            var controller = FindObjectOfType <UIController>();
            controller.FocusUIElement("JUMP");
            controller.FocusUIElement("SolutionWindow");
        }
            );

        step1.AddCompletionCondition(
            () => {
            var container = FindObjectOfType <InstructionContainer>();
            int numInPlay = container.Count;
            FocusInstruction(OpCode.JUMP);
            return((numInPlay > 0) && DragNDrop.CurrDragInstruction == null);
        }
            );

        TutorialStep step2 = new TutorialStep();

        step2.Description = "Fantas-tas-tas- *bzzrt* tastic. Let's break Computron and make an infinite loop!" +
                            "\n\n Drag the jump anchor to be above the jump instruction!";

        AddStep(step2);

        step2.AddBeginBehavior(
            () => {
            DisableInstructionInSolutionWindow(0);
            uiController.FocusUIElement("SolutionWindow");
        }
            );

        step2.AddCompletionCondition(
            () => {
            var container = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands  = container.GetComponentsInChildren <Command>();

            return(commands.Length > 0 &&
                   commands[0].Instruction == OpCode.NO_OP &&
                   DragNDrop.CurrDragInstruction == null);
        }
            );

        TutorialStep step3 = new TutorialStep();

        AddStep(step3);
        step3.Description = "Now, place an INPUT instruction between the JUMP instruction, and the unlabeled jump anchor. ";

        step3.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("SolutionWindow");
            DisableInstructionInSolutionWindow(0);
            DisableInstructionInSolutionWindow(1);
        }
            );

        step3.AddCompletionCondition(
            () => {
            FocusInstruction(OpCode.INPUT);
            var container = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands  = container.GetComponentsInChildren <Command>();
            return(commands.Length > 2 &&
                   commands[0].Instruction == OpCode.NO_OP &&
                   commands[1].Instruction == OpCode.INPUT &&
                   commands[2].Instruction == OpCode.JUMP &&
                   DragNDrop.CurrDragInstruction == null);
        }
            );

        TutorialStep step4 = new TutorialStep();

        AddStep(step4);
        step4.Description = "Hit play, and notice how-how-how *bzzrt* the game will never end.";

        step4.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("PlayButton");
        }
            );

        step4.AddCompletionCondition(
            () => {
            return(FindObjectOfType <Interpreter>().Running);
        }
            );

        TutorialStep step5 = new TutorialStep();

        AddStep(step5);
        step5.Description = "When you get dizzy, hit HALT";
        step5.AddBeginBehavior(
            () => {
            uiController.ClearFocus();
            uiController.HighlightUIElement("HaltButton");
            TextBoxController.gameObject.transform.position += new Vector3(5, 0);
        }
            );
        step5.AddCompletionCondition(
            () => {
            return(!FindObjectOfType <Interpreter>().Running);
        }
            );
        step5.AddEndBehavior(
            () => {
            TextBoxController.gameObject.transform.position += new Vector3(-5, 0);
        }
            );

        TutorialStep step6 = new TutorialStep();

        AddStep(step6);
        step6.Description = "Now, let's tell Computron how to break the loop." +
                            "\n\nDrag a JUMP IF NULL instruction into the solution window, and place it in between the INPUT and JUMP instructions.";
        //step6.EndDelay = 0.25f;
        step6.AddBeginBehavior(
            () => {
            FocusInstruction(OpCode.JUMP_IF_NULL);
            uiController.FocusUIElement("SolutionWindow");
            DisableInstructionInSolutionWindow(0);
            DisableInstructionInSolutionWindow(1);
            DisableInstructionInSolutionWindow(2);
        }
            );

        step6.AddCompletionCondition(
            () => {
            var container = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands  = container.GetComponentsInChildren <Command>();

            bool inputSeen = false;
            if (DragNDrop.CurrDragInstruction != null)
            {
                return(false);
            }

            for (int i = 0; i < commands.Length; i++)
            {
                if (commands[i].Instruction == OpCode.INPUT)
                {
                    inputSeen = true;
                    continue;
                }

                if (commands[i].Instruction == OpCode.JUMP_IF_NULL)
                {
                    if (!inputSeen)
                    {
                        return(false);
                    }
                    else if (i + 1 < commands.Length && commands[i + 1].Instruction == OpCode.JUMP)
                    {
                        return(true);
                    }
                    else if (i + 2 < commands.Length && commands[i + 2].Instruction == OpCode.JUMP)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
            );

        TutorialStep step7 = new TutorialStep();

        AddStep(step7);
        step7.Description = "Now, take the jump anchor tied to the JUMP IF NULL instruction, " +
                            "and drag it below the JUMP instruction";
        step7.AddBeginBehavior(
            () => {
            var container = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands  = container.GetComponentsInChildren <Command>();
            uiController.FocusUIElement("SolutionWindow");
            DisableAllInInstructionInSolutionWindow();
            foreach (var command in commands)
            {
                if (command.Instruction == OpCode.JUMP_IF_NULL)
                {
                    var dndBehavior = command.GetComponent <JumpDragNDropBehavior>();
                    var anchor      = dndBehavior.childAnchor;
                    var uiControl   = anchor.GetComponent <UIControl>();
                    uiControl.Enable();
                    break;
                }
            }
        }
            );

        step7.AddCompletionCondition(
            () => {
            var container = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands  = container.GetComponentsInChildren <Command>();
            return(commands[commands.Length - 1].Instruction == OpCode.NO_OP &&
                   DragNDrop.CurrDragInstruction == null);
        }
            );

        TutorialStep step8 = new TutorialStep();

        AddStep(step8);
        step8.Description = "Now hit p-p-p-p-play, and observe how computron breaks out of that infinite loop!";

        step8.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("PlayButton");
        }
            );

        step8.AddCompletionCondition(() => { return(FindObjectOfType <Interpreter>().Running); });

        TutorialStep step9 = new TutorialStep();

        AddStep(step9);
        step9.AddBeginBehavior(
            () => {
            TextBoxController.Deactivate();
            uiController.GetControllableUIElement("HaltButton").Disable();
        }
            );

        step9.AddCompletionCondition(
            () => {
            return(FindObjectOfType <Interpreter>().Halted);
        }
            );

        step9.AddEndBehavior(
            () => {
            uiController.GetControllableUIElement("HaltButton").Enable();
        }
            );

        TutorialStep step10 = new TutorialStep();

        AddStep(step10);
        step10.Description = "Whenever you're ready, hit *bzzzrt* HALT and solve the rest of the puzzle!";
        step10.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("HaltButton");
            uiController.HighlightUIElement("HaltButton");
        }
            );

        step10.AddCompletionCondition(
            () => {
            return(!FindObjectOfType <Interpreter>().Running);
        }
            );
    }
Beispiel #3
0
    protected override void Awake()
    {
        var step1 = new TutorialStep();

        AddStep(step1);
        step1.Description = "You-you-you got Memory Cards! Computrons are very forgetful, so memory cards allow them " +
                            "to remember more than one number at a time." +
                            "\n\n Drag both of the cards to the panel below to put them in play!";
        step1.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("RegisterHandSlot");
            uiController.HighlightUIElement("RegisterHandSlot");
            uiController.FocusUIElement("CardPlayArea");
            uiController.HighlightUIElement("CardPlayArea");
        }
            );

        step1.AddCompletionCondition(
            () => {
            return(FindObjectOfType <PlayedCardContainer>().Count > 1);
        }
            );

        var step2 = new TutorialStep();

        AddStep(step2);
        step2.Description = "To make use of those *bbbzrt* cards, you need to use the right instruction!" +
                            "\n\nDrag a MOVE_TO instruction into the solution window.";
        step2.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("SolutionWindow");
            FocusInstruction(OpCode.MOVE_TO);
        }
            );
        step2.AddCompletionCondition(
            () => {
            var container = FindObjectOfType <InstructionContainer>();
            int numInPlay = container.Count;
            FocusInstruction(OpCode.MOVE_TO);
            return((numInPlay > 0) && DragNDrop.CurrDragInstruction == null);
        }
            );

        var step3 = new TutorialStep();

        AddStep(step3);
        step3.Description = "Whenev-ev-ev-ever you play a card-based instruction, you must link it to a card that you played." +
                            "\n\nClick on one of the cards you played to link your instruction to it!";

        step3.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("CardPlayArea");
            var cards = FindObjectOfType <PlayedCardContainer>().GetCards();
            foreach (var card in cards)
            {
                card.GetComponent <UIControl>().Disable();
            }
        }
            );
        step3.AddCompletionCondition(
            () => {
            return(FindObjectOfType <CardInstructionLinker>() == null);
        }
            );
        step3.AddEndBehavior(
            () => {
            var cards = FindObjectOfType <PlayedCardContainer>().GetCards();
            foreach (var card in cards)
            {
                card.GetComponent <UIControl>().Enable();
            }
        }
            );

        var step4 = new TutorialStep();

        AddStep(step4);
        step4.Description = "If you ever make an ***ERROR***, you can always click on a card instruction's argument " +
                            "to relink that instruction." +
                            "\n\n Give it a try!";

        GameObject           boundCard        = null;
        CardCommandDragNDrop boundInstruction = null;

        step4.AddBeginBehavior(
            () => {
            var container      = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands       = container.GetComponentsInChildren <Command>();
            boundInstruction   = commands[0].GetComponent <CardCommandDragNDrop>();
            var label          = boundInstruction.ArgLabel;
            var labelUIControl = label.GetComponent <UIControl>();
            labelUIControl.Enable();
            uiController.FocusUIElement(labelUIControl);
            labelUIControl.StartHighlight();
        }
            );
        step4.AddCompletionCondition(() => { return(FindObjectOfType <CardInstructionLinker>() != null); });
        step4.AddEndBehavior(
            () => {
            boundCard = boundInstruction.BoundCard;
        }
            );

        var step5 = new TutorialStep();

        AddStep(step5);
        step5.Description = "Select another card to relink the MOVE_TO instruction";

        step5.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("CardPlayArea");
            uiController.FocusUIElement("RegisterHandSlot");
        }
            );
        step5.AddCompletionCondition(
            () => {
            return(FindObjectOfType <CardInstructionLinker>() == null);
        }
            );
        step5.AddEndBehavior(
            () => {
            var cards = FindObjectOfType <PlayedCardContainer>().GetCards();
            foreach (var card in cards)
            {
                card.GetComponent <UIControl>().Enable();
            }
        }
            );

        var step6 = new TutorialStep();

        AddStep(step6);
        step6.Description = "Now that you have your act together, let's see that memory card in action. " +
                            "\n\nPlay an INPUT instruction, and place it above the MOVE_TO";
        step6.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("SolutionWindow");
            DisableInstructionInSolutionWindow(0);
        }
            );

        step6.AddCompletionCondition(
            () => {
            FocusInstruction(OpCode.INPUT);
            var container = FindObjectOfType <InstructionContainer>().contentPanel;
            var commands  = container.GetComponentsInChildren <Command>();
            return(commands[0].Instruction == OpCode.INPUT && DragNDrop.CurrDragInstruction == null);
        }
            );

        TutorialStep step7 = new TutorialStep();

        AddStep(step7);
        step7.Description = "Hit play, and watch *bzzzrt* the magic happen.";

        step7.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("PlayButton");
        }
            );

        step7.AddCompletionCondition(
            () => {
            return(FindObjectOfType <Interpreter>().Running);
        }
            );
    }
Beispiel #4
0
    protected override void Awake()
    {
        //Drag INPUT into SolutionWindow
        TutorialStep step1 = new TutorialStep();

        AddStep(step1);
        step1.Description =
            "Try out those fancy new instructions you *bzzrt* got!  " +
            "\nTo write a command, drag an INPUT instruction into the SOLUTION WINDOW.";

        step1.AddBeginBehavior(
            () => {
            var controller = FindObjectOfType <UIController>();
            FocusInstruction(OpCode.INPUT);
            controller.FocusUIElement("SolutionWindow");
        }
            );

        step1.AddCompletionCondition(
            () => {
            GameObject solutionWindow = GameObject.FindGameObjectWithTag("SolutionWindow");
            int numInPlay             = solutionWindow.GetComponent <InstructionContainer>().Count;

            var instructionCache = GameObject.FindGameObjectWithTag("InstructionCacheContent");
            instructionCache.GetComponentInChildren <UIControl>().Focus();
            return((numInPlay > 0) && DragNDrop.CurrDragInstruction == null);
        }
            );

        TutorialStep step2 = new TutorialStep();

        step2.Description =
            "Press the play button to run your solution whenever you'd like." +
            "\n\nTry it now to see what happens *bzzrt* when you do something wrong!";

        step2.AddBeginBehavior(
            () => {
            uiController.FocusUIElement("PlayButton");
        }
            );

        step2.AddCompletionCondition(
            () => {
            return(FindObjectOfType <Interpreter>().Running);
        }
            );

        AddStep(step2);

        TutorialStep step3 = new TutorialStep();

        AddStep(step3);
        step3.AddBeginBehavior(
            () => {
            FindObjectOfType <TutorialTextBoxController>().Deactivate();
        }
            );

        step3.AddCompletionCondition(
            () => {
            return(FindObjectOfType <InputBox>().Count < 1);
        }
            );

        step3.AddEndBehavior(
            () => {
            FindObjectOfType <TutorialTextBoxController>().Activate();
        }
            );
        step3.EndDelay = 1.0f;


        TutorialStep step4 = new TutorialStep();

        AddStep(step4);
        step4.Description = "When Computron runs out *bzzrt* of instructions, your output is analyzed." +
                            "\n\nNow if you're ready to get to work, hit the halt button to stop the simulation and try again!";

        step4.AddBeginBehavior(
            () => {
            var controller = FindObjectOfType <UIController>();
            controller.FocusUIElement("SolutionWindow");
            controller.FocusUIElement("HaltButton");
            TextBoxController.transform.position += new Vector3(5, 0);
        }
            );

        step4.AddCompletionCondition(
            () => {
            return(!FindObjectOfType <Interpreter>().Running);
        }
            );

        step4.AddEndBehavior(
            () => {
            TextBoxController.transform.position -= new Vector3(5, 0);
        }
            );
    }