Example #1
0
    IEnumerator Complete()
    {
        complete    = true;
        running     = false;
        simIsParent = true;
        closestSeen = 0;
        UpdateText();
        timerScript.PauseTimer();

        /*foreach (CubeController item in cubeControllers)
         * {
         *  Destroy(item.gameObject);
         * }
         * foreach (CubeController item in childControllers)
         * {
         *  Destroy(item.gameObject);
         * }
         * cubeControllers = new List<CubeController>();
         * childControllers = new List<CubeController>();*/
        yield return(StartCoroutine(solutionScript.SolutionAnimation(bestSolution)));
    }
Example #2
0
    /* sending data
     * insertData.UpdateData(1,1,data.StringList[0]);
     * insertData.UpdateData(the level number,question number, the given answer); */

    /* Creating the question
     *  use this if you want to add a person or object who you dont need to give or give away
     *      need.AddToListString("Sandra");
     *  use this to set the object en the person you need to give it to
     *  you will not need to add the first option if you want to do this with the object
     *      need.NeededStringList.Add("bal>Harold"); */

    public void CurrentStageActive(int CurrentStageLevel)
    {
        /*Level 1 #############*/
        if (CurrentStageLevel == 1)   // level 1
        {
            if (currentStage == 1)
            {
                StartCoroutine(PlayAudio(question1, 3, 1)); // play the question once after the set amount of time has passed
                // who to give the object to
                need.NeededStringList.Add("bal>Harold");
                timer.PauseTimer();
                // InsertData to database // name and age of the user
                insertData.SetData(data.nameUser, data.ageUser);
            }
            if (currentStage == 2)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question2, 1, 2));
                StartCoroutine(SetTrue(question2.length));
                // who to give the object to
                need.NeededStringList.Add("yoyo>Berry");
                // InsertData to database // answers
                insertData.UpdateData(1, 1, data.StringList[0]);
            }
            if (currentStage == 3)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question3, 1, 3));
                StartCoroutine(SetTrue(question3.length));
                // who to give the object to
                need.NeededStringList.Add("ballon>Karin");
                // InsertData to database // answers
                insertData.UpdateData(1, 2, data.StringList[1]);
            }
            if (currentStage == 4)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question4, 1, 4));
                StartCoroutine(SetTrue(question4.length));
                // who to give the object to
                need.NeededStringList.Add("beer>Milo");
                // InsertData to database // answers
                insertData.UpdateData(1, 3, data.StringList[2]);
            }
            // final stage of the level
            if (currentStage == 5)
            {
                stageCompleted             = true;
                nextQuestion.interactable  = true;
                checkQuestion.interactable = false;
                replayAudio.interactable   = false;
                // turn all the buttons non interactible
                for (int i = 0; i < toolbox.ButtonList.Count; i++)
                {
                    // add the collider to the screenlist
                    toolbox.ButtonList[i].GetComponent <Button>().interactable = false;
                }
                // InsertData to database // answers
                insertData.UpdateData(1, 4, data.StringList[3]);
                // show end score
                StartCoroutine(Stars(1));
            }
        }

        /*Level 2 #############*/
        if (CurrentStageLevel == 2)   // level 2
        {
            if (currentStage == 6)
            {
                StartCoroutine(PlayAudio(question1, 3, 6)); // play the question once after the set amount of time has passed
                // add needed object to list
                need.AddToListString("Milo");
                // InsertData to database // name and age of the user
                insertData.SetData(data.nameUser, data.ageUser);
                timer.PauseTimer();
            }
            if (currentStage == 7)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question2, 1, 7));
                StartCoroutine(SetTrue(question2.length));
                // add needed object to list
                need.AddToListString("Milo");
                // InsertData to database // answers
                insertData.UpdateData(2, 5, data.StringList[4]);
            }
            if (currentStage == 8)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question3, 1, 8));
                StartCoroutine(SetTrue(question3.length));
                // add needed object to list
                need.AddToListString("Milo");
                // InsertData to database // answers
                insertData.UpdateData(2, 6, data.StringList[5]);
            }
            if (currentStage == 9)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question4, 1, 9));
                StartCoroutine(SetTrue(question4.length));
                // add needed object to list
                need.AddToListString("Milo");
                // InsertData to database // answers
                insertData.UpdateData(2, 7, data.StringList[6]);
            }
            // final stage of the level
            if (currentStage == 10)
            {
                stageCompleted             = true;
                nextQuestion.interactable  = true;
                checkQuestion.interactable = false;
                replayAudio.interactable   = false;
                // turn all the buttons non interactible
                for (int i = 0; i < toolbox.ButtonList.Count; i++)
                {
                    // add the collider to the screenlist
                    toolbox.ButtonList[i].GetComponent <Button>().interactable = false;
                }
                // InsertData to database // answers
                insertData.UpdateData(2, 8, data.StringList[7]);
                // show end score
                StartCoroutine(Stars(1));
            }
        }

        /*Level 3 #############*/
        if (CurrentStageLevel == 3)   // level 3
        {
            if (currentStage == 11)
            {
                StartCoroutine(PlayAudio(question1, 3, 11)); // play the question once after the set amount of time has passed
                // add needed object to list
                need.AddToListString("ballon");
                // who to give the object to
                //need.NeededStringList.Add("Yoyo>Karin");
                timer.PauseTimer();
            }
            if (currentStage == 12)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question2, 1, 12));
                StartCoroutine(SetTrue(question2.length));
                // add needed object to list
                need.AddToListString("ballon");
                // InsertData to database // answers
                insertData.UpdateData(3, 9, data.StringList[8]);
            }
            if (currentStage == 13)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question3, 1, 13));
                StartCoroutine(SetTrue(question3.length));
                // add needed object to list
                need.AddToListString("ballon");
                // InsertData to database // answers
                insertData.UpdateData(3, 10, data.StringList[9]);
            }
            if (currentStage == 14)
            {
                checkQuestion.interactable = false;
                StartCoroutine(PlayAudio(question4, 1, 14));
                StartCoroutine(SetTrue(question4.length));
                // add needed object to list
                need.AddToListString("ballon");
                // InsertData to database // answers
                insertData.UpdateData(3, 11, data.StringList[10]);
            }
            // final stage of the level
            if (currentStage == 15)
            {
                stageCompleted             = true;
                nextQuestion.interactable  = true;
                checkQuestion.interactable = false;
                replayAudio.interactable   = false;
                // turn all the buttons non interactible
                for (int i = 0; i < toolbox.ButtonList.Count; i++)
                {
                    // add the collider to the screenlist
                    toolbox.ButtonList[i].GetComponent <Button>().interactable = false;
                }
                // InsertData to database // answers
                insertData.UpdateData(3, 12, data.StringList[11]);
                // show end score
                StartCoroutine(Stars(1));
            }
        }

        // set all objects inactive and play their particlesystem
        if (doneButtons <= toolbox.ButtonList.Count)
        {
            for (i = 0; i < toolbox.ButtonList.Count; i++)
            {
                toolbox.ButtonList[i].GetComponent <ToolBoxChoose>().SetOrigin();
                doneButtons++;
            }
        }
        doneButtons = 0;
        i           = 0;
    }