public void Game_click()
 {
     if (gameController.levelNumber == 1)
     {
         if (gameController.scene == Constants.CHILD_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-guesser-start", true, -1, -1, -1);
             SceneManager.LoadScene("Child_guessing_L1");
         }
         else if (gameController.scene == Constants.ROBOT_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-builder-start", true, -1, -1, -1);
             SceneManager.LoadScene("Builder_L1");
         }
     }
     if (gameController.levelNumber == 2)
     {
         if (gameController.scene == Constants.CHILD_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-guesser-start", true, -1, -1, -1);
             SceneManager.LoadScene("Child_guessing_L2");
         }
         else if (gameController.scene == Constants.ROBOT_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-builder-start", true, -1, -1, -1);
             SceneManager.LoadScene("Builder_L2");
         }
     }
     if (gameController.levelNumber == 3)
     {
         if (gameController.scene == Constants.CHILD_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-guesser-start", true, -1, -1, -1);
             SceneManager.LoadScene("Child_guessing_L3");
         }
         else if (gameController.scene == Constants.ROBOT_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-builder-start", true, -1, -1, -1);
             SceneManager.LoadScene("Builder_L3");
         }
     }
     if (gameController.levelNumber == 4)
     {
         if (gameController.scene == Constants.CHILD_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-guesser-start", true, -1, -1, -1);
             SceneManager.LoadScene("Child_guessing_L4");
         }
         else if (gameController.scene == Constants.ROBOT_GUESSING_SCENE)
         {
             gameController.SendRobotUtterance("child-builder-start", true, -1, -1, -1);
             SceneManager.LoadScene("Builder_L4");
         }
     }
 }
        // Use this for initialization
        void Start()
        {
            gameController.SendRobotUtterance("child-guesser-start", false, -1, -1, -1);
            CreateRandomHouse();
            SelectedHouseOnScreenRandomSpot();

            CreateVariations();
            VariationHousesOnScreen();

            CreateQuestionPieces();
        }
 // Update is called once per frame
 void Update()
 {
     if ((tutorial_step == 0) && (!updated))
     {
         gameController.SendRobotUtterance("robot-guessing-tutorial-1", true, -1, -1, -1);
         GameObject question = Instantiate(gameController.wallHousePieceOptions[0]);
         var        canvas   = GameObject.Find("Guess_Panel");
         question.transform.SetParent(canvas.transform, false);
         GameObject y = GameObject.Find("circle-yes");
         y.gameObject.GetComponent <Renderer>().enabled = true;
         updated = true;
     }
     if ((tutorial_step == 1) && (!updated))
     {
         gameController.SendRobotUtterance("robot-guessing-tutorial-2", true, -1, -1, -1);
         GameObject question = Instantiate(gameController.doorHousePieceOptions[1]);
         var        canvas   = GameObject.Find("Guess_Panel");
         question.transform.SetParent(canvas.transform, false);
         GameObject right_arrow = Instantiate(right);
         right_arrow.transform.SetParent(canvas.transform, false);
         GameObject y = GameObject.Find("circle-yes");
         y.gameObject.GetComponent <Renderer>().enabled = true;
         updated = true;
     }
     if ((tutorial_step == 2) && (!updated))
     {
         gameController.SendRobotUtterance("robot-guessing-tutorial-3", true, -1, -1, -1);
         GameObject y = GameObject.Find("circle-yes");
         y.gameObject.GetComponent <Renderer>().enabled = false;
         GameObject question = Instantiate(gameController.roofHousePieceOptions[1]);
         var        canvas   = GameObject.Find("Guess_Panel");
         question.transform.SetParent(canvas.transform, false);
         GameObject n = GameObject.Find("circle-no");
         n.gameObject.GetComponent <Renderer>().enabled = true;
         updated = true;
     }
     if ((tutorial_step == 3) && (!updated))
     {
         gameController.SendRobotUtterance("robot-guessing-tutorial-4", true, -1, -1, -1);
         GameObject n = GameObject.Find("circle-no");
         n.gameObject.GetComponent <Renderer>().enabled = false;
         GameObject question = Instantiate(gameController.colorHousePieceOptions[0]);
         var        canvas   = GameObject.Find("Guess_Panel");
         question.transform.SetParent(canvas.transform, false);
         GameObject y = GameObject.Find("circle-yes");
         y.gameObject.GetComponent <Renderer>().enabled = true;
         updated = true;
     }
     if ((tutorial_step == 4) && (!updated))
     {
         updated = true;
         SceneManager.LoadScene("Both_houses_tutorial");
     }
 }
        public void FinishBuilding()
        {
            if (gameController.internalGameState == Constants.END_GAME)
            {
                gameController.SendRobotUtterance("end-game", false, -1, -1, -1);
                Logger.Log("GoingToQuit");
                //Application.Quit();
            }

            // load the builder scene
            if (gameController.levelNumber == 1)
            {
                SceneManager.LoadScene("Robot_guessing_L1");
            }
            if (gameController.levelNumber == 2)
            {
                SceneManager.LoadScene("Robot_guessing_L2");
            }
            if (gameController.levelNumber == 3)
            {
                SceneManager.LoadScene("Robot_guessing_L3");
            }
            if (gameController.levelNumber == 4)
            {
                SceneManager.LoadScene("Robot_guessing_L4");
            }
        }
        // Use this for initialization
        void Start()
        {
            gameController = GameObject.Find("GameManager").GetComponent <MainGameController>();


            var w1 = GameObject.Find("body1");
            var w2 = GameObject.Find("body2");
            var w3 = GameObject.Find("body3");
            var w4 = GameObject.Find("body4");
            var d1 = GameObject.Find("door1");
            var r1 = GameObject.Find("roof1");
            var d2 = GameObject.Find("door2");

            GameObject wall1 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall2 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall3 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall4 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject door  = Instantiate(gameController.doorHousePieceOptions[0]);
            GameObject roof  = Instantiate(gameController.roofHousePieceOptions[0]);
            GameObject door2 = Instantiate(gameController.doorHousePieceOptions[1]);

            wall1.transform.SetParent(w1.transform, false);
            wall2.transform.SetParent(w2.transform, false);
            wall3.transform.SetParent(w3.transform, false);
            wall4.transform.SetParent(w4.transform, false);
            door.transform.SetParent(d1.transform, false);
            roof.transform.SetParent(r1.transform, false);
            door2.transform.SetParent(d2.transform, false);

            gameController.SendRobotUtterance("robot-guessing-tutorial", true, -1, -1, -1);
        }
        // Use this for initialization
        void Start()
        {
            gameController = GameObject.Find("GameManager").GetComponent <MainGameController>();

            if (gameController.scene == Constants.ROBOT_GUESSING_SCENE)
            {
                guess        = GameObject.Find("RobotGuessingManager").GetComponent <RobotGuesser>();
                childbuilder = GameObject.Find("ExplainerSceneManager").GetComponent <ChildBuilder>();
                guessedHouse = guess.finalHouse;
                builtHouse   = childbuilder.explainerHouse;
                gameController.SendRobotUtterance("child-builder-compare-houses", false, -1, -1, -1);

                /*var cl = GameObject.Find("child_left");
                 * var rr = GameObject.Find("robot_right");
                 *
                 * cl.gameObject.GetComponent<Text>().enabled = true;
                 * rr.gameObject.GetComponent<Text>().enabled = true;*/
            }
            else if (gameController.scene == Constants.CHILD_GUESSING_SCENE)
            {
                if (gameController.tutorial)
                {
                    childTut = GameObject.Find("ChildGuessingManager").GetComponent <ChildGuesserTutorial>();
                    correct  = childTut.chosenHouse;
                    guessed  = childTut.submittedHouse;
                }
                else
                {
                    child   = GameObject.Find("ChildGuessingManager").GetComponent <ChildGuesser>();
                    correct = child.chosenHouse;
                    guessed = child.submittedHouse;
                }

                gameController.SendRobotUtterance("robot-builder-compare-houses", false, -1, -1, -1);

                /*var cr = GameObject.Find("child_right");
                 * var rl = GameObject.Find("robot_left");
                 *
                 * cr.gameObject.GetComponent<Text>().enabled = true;
                 * rl.gameObject.GetComponent<Text>().enabled = true;*/
            }
            level = gameController.levelNumber;

            showOnScreen();
        }
Exemple #7
0
        void Start()
        {
            // hide the restart button
            restartButton.SetActive(false);

            // show the rockets
            //gameController.PlaceHousesOnScreenSideBySide ();

            // update the performance metrics
            //gameController.UpdatePerformanceMetrics (true);

            // send robot utterance that the round is over and try to find one mistake to highlight
            gameController.SendRobotUtterance("round-over", false, -1, -1, -1);
            //mistakeMadePiecePair = gameController.FindOneMistakeBetweenRockets ();
            //feedbackUtteranceToMake = DetermineFeedbackToGive (mistakeMadePiecePair);

            // initialize the timing variables
            secondsElapsed = 0;
            timeElapsed    = 0f;
        }
        private void showOnScreen()
        {
            // builder house ----------------------------------------------------------------------------
            var Bw1 = GameObject.Find("built_w1");
            var Bw2 = GameObject.Find("built_w2");
            var Bw3 = GameObject.Find("built_w3");
            var Bw4 = GameObject.Find("built_w4");
            var Bd1 = GameObject.Find("built_d1");
            var Br1 = GameObject.Find("built_r1");
            var Bd2 = GameObject.Find("built_d2");

            GameObject Bwall1 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject Bwall2 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject Bwall3 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject Bwall4 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject Bdoor1 = Instantiate(gameController.doorHousePieceOptions[0]);
            GameObject Broof  = Instantiate(gameController.roofHousePieceOptions[0]);
            GameObject Bdoor2 = Instantiate(gameController.doorHousePieceOptions[1]);

            Bwall1.transform.SetParent(Bw1.transform, false);
            Bwall2.transform.SetParent(Bw2.transform, false);
            Bwall3.transform.SetParent(Bw3.transform, false);
            Bwall4.transform.SetParent(Bw4.transform, false);
            Bdoor1.transform.SetParent(Bd1.transform, false);
            Broof.transform.SetParent(Br1.transform, false);
            Bdoor2.transform.SetParent(Bd2.transform, false);

            // guessed house ----------------------------------------------------------------------------
            var Gw1 = GameObject.Find("guess_w1");
            var Gw2 = GameObject.Find("guess_w2");
            var Gw3 = GameObject.Find("guess_w3");
            var Gw4 = GameObject.Find("guess_w4");
            var Gd1 = GameObject.Find("guess_d1");
            var Gr1 = GameObject.Find("guess_r1");
            var Gd2 = GameObject.Find("guess_d2");

            GameObject Gwall1 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject Gwall2 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject Gwall3 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject Gwall4 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject Gdoor  = Instantiate(gameController.doorHousePieceOptions[0]);
            GameObject Groof  = Instantiate(gameController.roofHousePieceOptions[0]);
            GameObject Gdoor2 = Instantiate(gameController.doorHousePieceOptions[1]);

            Gwall1.transform.SetParent(Gw1.transform, false);
            Gwall2.transform.SetParent(Gw2.transform, false);
            Gwall3.transform.SetParent(Gw3.transform, false);
            Gwall4.transform.SetParent(Gw4.transform, false);
            Gdoor.transform.SetParent(Gd1.transform, false);
            Groof.transform.SetParent(Gr1.transform, false);
            Gdoor2.transform.SetParent(Gd2.transform, false);

            gameController.SendRobotUtterance("robot-both-houses-tutorial-1", true, -1, -1, -1);
        }
        void Start()
        {
            //DontDestroyOnLoad(gameObject);
            // initialize pieceTypeSelected
            currentPieceTypeSelected = Constants.NONE_SELECTED;
            lastPieceTypeSelected    = Constants.NONE_SELECTED;

            gameController = GameObject.Find("GameManager").GetComponent <MainGameController>();
            gameController.currentScene = Constants.EXPLAINER_SCENE;
            levelNumber = gameController.levelNumber;

            if (gameController.tutorial)
            {
                explainerHouse = new ConstructedHouse(4, 2, 0, 1);
            }
            else
            {
                if (levelNumber == 1)
                {
                    explainerHouse = new ConstructedHouse(4, 1, 0, 1);
                }
                if (levelNumber == 2)
                {
                    explainerHouse = new ConstructedHouse(4, 1, 1, 1);
                }
                if (levelNumber == 3)
                {
                    explainerHouse = new ConstructedHouse(4, 1, 1, 2);
                }
                if (levelNumber == 4)
                {
                    explainerHouse = new ConstructedHouse(4, 1, 2, 2);
                }
            }

            // set up the scene
            SetUpExplainerScene();

            // enable drag and drop functionality
            EnableDragAndDropGameplay();

            // turn off the buttons
            explainerCompleteButton.SetActive(false);
            //switchToBuilderButton.SetActive (false);

            // subscribe to appropriate events
            Slot.OnPieceAddedToHouse          += ExplainerPieceAddedToHouse;
            DragHandler.OnPieceRemovedByTrash += ExplainerPieceRemoved;
            wall_piece_type = Constants.TYPE_WALL_NONE;

            tutorial_step = 0;
            gameController.SendRobotUtterance("child-building-tutorial", true, -1, -1, -1);
        }
Exemple #10
0
        // Use this for initialization
        void Start()
        {
            chosenHouse.wall  = 1;
            chosenHouse.door1 = 0;
            chosenHouse.roof  = 1;

            // house 1 ----------------------------------------------------------------------------
            var h1_b1 = GameObject.Find("h1_b1");
            var h1_b2 = GameObject.Find("h1_b2");
            var h1_b3 = GameObject.Find("h1_b3");
            var h1_b4 = GameObject.Find("h1_b4");
            var h1_d1 = GameObject.Find("h1_d1");
            var h1_r1 = GameObject.Find("h1_r1");


            GameObject wall11 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall12 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall13 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall14 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject door11 = Instantiate(gameController.doorHousePieceOptions[0]);
            GameObject roof11 = Instantiate(gameController.roofHousePieceOptions[0]);


            wall11.transform.SetParent(h1_b1.transform, false);
            wall12.transform.SetParent(h1_b2.transform, false);
            wall13.transform.SetParent(h1_b3.transform, false);
            wall14.transform.SetParent(h1_b4.transform, false);
            door11.transform.SetParent(h1_d1.transform, false);
            roof11.transform.SetParent(h1_r1.transform, false);


            // house 2 ----------------------------------------------------------------------------
            var h2_b1 = GameObject.Find("h2_b1");
            var h2_b2 = GameObject.Find("h2_b2");
            var h2_b3 = GameObject.Find("h2_b3");
            var h2_b4 = GameObject.Find("h2_b4");
            var h2_d1 = GameObject.Find("h2_d1");
            var h2_r1 = GameObject.Find("h2_r1");


            GameObject wall21 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall22 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall23 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject wall24 = Instantiate(gameController.wallHousePieceOptions[0]);
            GameObject door21 = Instantiate(gameController.doorHousePieceOptions[1]);
            GameObject roof21 = Instantiate(gameController.roofHousePieceOptions[0]);


            wall21.transform.SetParent(h2_b1.transform, false);
            wall22.transform.SetParent(h2_b2.transform, false);
            wall23.transform.SetParent(h2_b3.transform, false);
            wall24.transform.SetParent(h2_b4.transform, false);
            door21.transform.SetParent(h2_d1.transform, false);
            roof21.transform.SetParent(h2_r1.transform, false);


            // house 3 ----------------------------------------------------------------------------
            var h3_b1 = GameObject.Find("h3_b1");
            var h3_b2 = GameObject.Find("h3_b2");
            var h3_b3 = GameObject.Find("h3_b3");
            var h3_b4 = GameObject.Find("h3_b4");
            var h3_d1 = GameObject.Find("h3_d1");
            var h3_r1 = GameObject.Find("h3_r1");


            GameObject wall31 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject wall32 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject wall33 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject wall34 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject door31 = Instantiate(gameController.doorHousePieceOptions[0]);
            GameObject roof31 = Instantiate(gameController.roofHousePieceOptions[1]);


            wall31.transform.SetParent(h3_b1.transform, false);
            wall32.transform.SetParent(h3_b2.transform, false);
            wall33.transform.SetParent(h3_b3.transform, false);
            wall34.transform.SetParent(h3_b4.transform, false);
            door31.transform.SetParent(h3_d1.transform, false);
            roof31.transform.SetParent(h3_r1.transform, false);


            // house 4 ----------------------------------------------------------------------------
            var h4_b1 = GameObject.Find("h4_b1");
            var h4_b2 = GameObject.Find("h4_b2");
            var h4_b3 = GameObject.Find("h4_b3");
            var h4_b4 = GameObject.Find("h4_b4");
            var h4_d1 = GameObject.Find("h4_d1");
            var h4_r1 = GameObject.Find("h4_r1");


            GameObject wall41 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject wall42 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject wall43 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject wall44 = Instantiate(gameController.wallHousePieceOptions[1]);
            GameObject door41 = Instantiate(gameController.doorHousePieceOptions[1]);
            GameObject roof41 = Instantiate(gameController.roofHousePieceOptions[1]);


            wall41.transform.SetParent(h4_b1.transform, false);
            wall42.transform.SetParent(h4_b2.transform, false);
            wall43.transform.SetParent(h4_b3.transform, false);
            wall44.transform.SetParent(h4_b4.transform, false);
            door41.transform.SetParent(h4_d1.transform, false);
            roof41.transform.SetParent(h4_r1.transform, false);


            CreateQuestionPieces();
            gameController.SendRobotUtterance("child-guesser", true, -1, -1, -1);
        }
        // Use this for initialization
        void Start()
        {
            //level = 1;

            gameController.SendRobotUtterance("child-answering-questions-start", false, -1, -1, -1);

            if (gameController.tutorial)
            {
                {
                    pieceoptions = 4;
                    houseoptions = 5; //wall,door1,roof,plant1,door2

                    var w1 = GameObject.Find("body1");
                    var w2 = GameObject.Find("body2");
                    var w3 = GameObject.Find("body3");
                    var w4 = GameObject.Find("body4");
                    var d1 = GameObject.Find("door1");
                    var r1 = GameObject.Find("roof1");
                    var d2 = GameObject.Find("door2");

                    GameObject wall1 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                    GameObject wall2 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                    GameObject wall3 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                    GameObject wall4 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                    GameObject door  = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door1]);
                    GameObject roof  = Instantiate(gameController.roofHousePieceOptions[childbuilder.explainerHouse.roof]);
                    GameObject door2 = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door2]);

                    wall1.transform.SetParent(w1.transform, false);
                    wall2.transform.SetParent(w2.transform, false);
                    wall3.transform.SetParent(w3.transform, false);
                    wall4.transform.SetParent(w4.transform, false);
                    door.transform.SetParent(d1.transform, false);
                    roof.transform.SetParent(r1.transform, false);
                    door2.transform.SetParent(d2.transform, false);
                }
            }

            if ((level == 1) && (!gameController.tutorial))
            {
                pieceoptions = 2;
                houseoptions = 3; //wall,door,roof
                var w1 = GameObject.Find("body1");
                var w2 = GameObject.Find("body2");
                var w3 = GameObject.Find("body3");
                var w4 = GameObject.Find("body4");
                var d1 = GameObject.Find("door1");
                var r1 = GameObject.Find("roof1");

                GameObject wall1 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall2 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall3 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall4 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject door  = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door1]);
                GameObject roof  = Instantiate(gameController.roofHousePieceOptions[childbuilder.explainerHouse.roof]);

                wall1.transform.SetParent(w1.transform, false);
                wall2.transform.SetParent(w2.transform, false);
                wall3.transform.SetParent(w3.transform, false);
                wall4.transform.SetParent(w4.transform, false);
                door.transform.SetParent(d1.transform, false);
                roof.transform.SetParent(r1.transform, false);
            }
            if ((level == 2) && (!gameController.tutorial))
            {
                pieceoptions = 3;
                houseoptions = 4; //wall,door,roof,plant

                var w1 = GameObject.Find("body1");
                var w2 = GameObject.Find("body2");
                var w3 = GameObject.Find("body3");
                var w4 = GameObject.Find("body4");
                var d1 = GameObject.Find("door1");
                var r1 = GameObject.Find("roof1");
                var p1 = GameObject.Find("plant1");

                GameObject wall1 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall2 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall3 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall4 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject door  = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door1]);
                GameObject roof  = Instantiate(gameController.roofHousePieceOptions[childbuilder.explainerHouse.roof]);
                GameObject plant = Instantiate(gameController.plantHousePieceOptions[childbuilder.explainerHouse.plant1]);

                wall1.transform.SetParent(w1.transform, false);
                wall2.transform.SetParent(w2.transform, false);
                wall3.transform.SetParent(w3.transform, false);
                wall4.transform.SetParent(w4.transform, false);
                door.transform.SetParent(d1.transform, false);
                roof.transform.SetParent(r1.transform, false);
                plant.transform.SetParent(p1.transform, false);
            }
            if ((level == 3) && (!gameController.tutorial))
            {
                pieceoptions = 4;
                houseoptions = 5; //wall,door1,roof,plant1,door2

                var w1 = GameObject.Find("body1");
                var w2 = GameObject.Find("body2");
                var w3 = GameObject.Find("body3");
                var w4 = GameObject.Find("body4");
                var d1 = GameObject.Find("door1");
                var r1 = GameObject.Find("roof1");
                var p1 = GameObject.Find("plant1");
                var d2 = GameObject.Find("door2");

                GameObject wall1 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall2 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall3 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall4 = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject door  = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door1]);
                GameObject roof  = Instantiate(gameController.roofHousePieceOptions[childbuilder.explainerHouse.roof]);
                GameObject plant = Instantiate(gameController.plantHousePieceOptions[childbuilder.explainerHouse.plant1]);
                GameObject door2 = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door2]);

                wall1.transform.SetParent(w1.transform, false);
                wall2.transform.SetParent(w2.transform, false);
                wall3.transform.SetParent(w3.transform, false);
                wall4.transform.SetParent(w4.transform, false);
                door.transform.SetParent(d1.transform, false);
                roof.transform.SetParent(r1.transform, false);
                plant.transform.SetParent(p1.transform, false);
                door2.transform.SetParent(d2.transform, false);
            }
            if ((level == 4) && (!gameController.tutorial))
            {
                pieceoptions = 6;
                houseoptions = 6; //wall,door1,roof,plant1,door2,plant2

                var w1 = GameObject.Find("body1");
                var w2 = GameObject.Find("body2");
                var w3 = GameObject.Find("body3");
                var w4 = GameObject.Find("body4");
                var d1 = GameObject.Find("door1");
                var r1 = GameObject.Find("roof1");
                var p1 = GameObject.Find("plant1");
                var d2 = GameObject.Find("door2");
                var p2 = GameObject.Find("plant2");

                GameObject wall1  = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall2  = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall3  = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject wall4  = Instantiate(gameController.wallHousePieceOptions[childbuilder.explainerHouse.wall]);
                GameObject door   = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door1]);
                GameObject roof   = Instantiate(gameController.roofHousePieceOptions[childbuilder.explainerHouse.roof]);
                GameObject plant  = Instantiate(gameController.plantHousePieceOptions[childbuilder.explainerHouse.plant1]);
                GameObject door2  = Instantiate(gameController.doorHousePieceOptions[childbuilder.explainerHouse.door2]);
                GameObject plant2 = Instantiate(gameController.plantHousePieceOptions[childbuilder.explainerHouse.plant2]);

                wall1.transform.SetParent(w1.transform, false);
                wall2.transform.SetParent(w2.transform, false);
                wall3.transform.SetParent(w3.transform, false);
                wall4.transform.SetParent(w4.transform, false);
                door.transform.SetParent(d1.transform, false);
                roof.transform.SetParent(r1.transform, false);
                plant.transform.SetParent(p1.transform, false);
                door2.transform.SetParent(d2.transform, false);
                plant2.transform.SetParent(p2.transform, false);
            }

            numbposs = (int)(Math.Pow(pieceoptions, houseoptions));
            CreateAllHouses();
            CreateCharacteristics();
            FindBestGuess();
        }
 public void NewGame()
 {
     if (gameController.internalGameState == Constants.END_GAME)
     {
         gameController.SendRobotUtterance("end-game", false, -1, -1, -1);
         Logger.Log("GoingToQuit");
         //Application.Quit();
     }
     //gameController.StartNextGame();
     gameController.levelNumber = gameController.saveLevel;
     level = gameController.saveLevel;
     if (gameController.tutorial)
     {
         gameController.tutorial = false;
     }
     if (gameController.scene == Constants.ROBOT_GUESSING_SCENE)
     {
         gameController.scene = Constants.CHILD_GUESSING_SCENE;
         Destroy(GameObject.Find("ExplainerSceneManager"));
         Destroy(GameObject.Find("RobotGuessingManager"));
         SceneManager.LoadScene("Child_guessing_L" + gameController.levelNumber);
     }
     else if (gameController.scene == Constants.CHILD_GUESSING_SCENE)
     {
         gameController.scene = Constants.ROBOT_GUESSING_SCENE;
         Destroy(GameObject.Find("ExplainerSceneManager"));
         Destroy(GameObject.Find("ChildGuessingManager"));
         SceneManager.LoadScene("Builder_L" + gameController.levelNumber);
     }
 }
        void Update()
        {
            // perform the steps of the tutorial
            if (gameController.tutorial)
            {
                //gameController.SendRobotUtterance("child-building-tutorial", true, -1, -1, -1);
                // make child drag wall piece.
                if ((tutorial_step == 0) && (!updated))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-1", true, -1, -1, -1);
                    ShowSelectedWallPieces();
                    updated = true;
                }
                if ((explainerHouse.n_wall_pieces == 1) && (tutorial_step == 0))
                {
                    GameObject w = GameObject.Find("arrow_wall");
                    w.gameObject.GetComponent <Renderer>().enabled = false;
                    tutorial_step++;
                    updated = false;
                }


                // make child drag other type of wall piece
                if ((tutorial_step == 1) && (!updated))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-3", true, -1, -1, -1);
                    GameObject w2 = GameObject.Find("arrow_wall_not");
                    w2.gameObject.GetComponent <Renderer>().enabled = true;
                    GameObject w2n = GameObject.Find("wall_not");
                    w2n.gameObject.GetComponent <Renderer>().enabled = true;
                    updated = true;
                }

                if ((explainerHouse.n_wall_pieces == 4) && (tutorial_step == 1))
                {
                    GameObject w2  = GameObject.Find("arrow_wall_not");
                    GameObject w2n = GameObject.Find("wall_not");
                    w2.gameObject.GetComponent <Renderer>().enabled  = false;
                    w2n.gameObject.GetComponent <Renderer>().enabled = false;
                    tutorial_step++;
                    updated = false;
                }

                // Ask child to put on one roof
                if ((tutorial_step == 2) && (!updated))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-4", true, -1, -1, -1);
                    GameObject r1 = GameObject.Find("arrow_roof");
                    r1.gameObject.GetComponent <Renderer>().enabled = true;
                    HideSelectedWallPieces();
                    ShowSelectedRoofPieces();
                    updated = true;
                }

                if ((explainerHouse.n_roof_pieces == 1) && (tutorial_step == 2))
                {
                    tutorial_step++;
                    updated = false;
                }


                // Trash roof
                if ((tutorial_step == 3) && (!updated))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-6", true, -1, -1, -1);
                    GameObject r1 = GameObject.Find("arrow_roof");
                    r1.gameObject.GetComponent <Renderer>().enabled = false;
                    GameObject r2 = GameObject.Find("arrow_roof_trash");
                    r2.gameObject.GetComponent <Renderer>().enabled = true;
                    updated = true;
                }
                // ask to trash roof piece

                if ((explainerHouse.n_roof_pieces == 0) && (tutorial_step == 3))
                {
                    tutorial_step++;
                    updated = false;
                }


                // Put on other roof
                if ((tutorial_step == 4) && (updated == false))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-7", true, -1, -1, -1);
                    GameObject r2 = GameObject.Find("arrow_roof_trash");
                    r2.gameObject.GetComponent <Renderer>().enabled = false;
                    updated = true;
                }
                if ((explainerHouse.n_roof_pieces == 1) && (tutorial_step == 4))
                {
                    tutorial_step++;
                    updated = false;
                }



                // Add two different doors
                if ((tutorial_step == 5) && (updated == false))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-8", true, -1, -1, -1);
                    HideSelectedRoofPieces();
                    ShowSelectedDoorPieces();
                    updated = true;
                }
                if ((explainerHouse.n_door_pieces == 2) && (tutorial_step == 5))
                {
                    tutorial_step++;
                    updated = false;
                }


                // house is complete. Press button
                if ((tutorial_step == 6) && (updated == false))
                {
                    gameController.SendRobotUtterance("child-building-tutorial-10", true, -1, -1, -1);
                    explainerCompleteButton.SetActive(true);
                    updated = true;
                }
            }
        }