public void selectObject(GameObject obj, SceneMenu.Stage stage, PlayerController.Hint hint)
    {
        switch (stage)
        {
        case SceneMenu.Stage.WHAT_IS_SHE_LOOKINH_AT:
            recordStage = (int)SceneMenu.Stage.WHAT_IS_SHE_LOOKINH_AT;
            switch (hint)
            {
            case PlayerController.Hint.ARROW:
                stage1_answers[0] = obj.ToString();
                break;

            case PlayerController.Hint.FINGER:
                stage1_answers[1] = obj.ToString();
                break;

            case PlayerController.Hint.FLICKER:
                stage1_answers[2] = obj.ToString();
                break;

            case PlayerController.Hint.End:
                stage1_answers[3] = obj.ToString();
                break;
            }
            break;

        case SceneMenu.Stage.HOW_DEOS_SHE_FEEL_ABOUT:
            break;
        }
    }
예제 #2
0
    void OnTriggerEnter(Collider other)
    {
        scene.instruction.SetActive(false);
        switch (state)
        {
        case State.FIRST_STATE:     // Tsai: Use enumeration to define states
            select = Array.IndexOf(scene.items, other.gameObject);
            if (select == -1)
            {
                state = State.FIRST_STATE;
            }
            else
            {
                state = State.SECOND_STATE;
                scene.YesOrNo.transform.position = new Vector3(scene.items[select].transform.position.x, scene.items[select].gameObject.transform.position.y + float.Parse("0.5"), 1);
                scene.YesOrNo.SetActive(true);
                foreach (GameObject it in scene.yes_no)
                {
                    it.SetActive(true);
                }
                scene.yes_no[0].gameObject.transform.position = new Vector3(scene.items[select].gameObject.transform.position.x - float.Parse("0.5"), scene.items[select].gameObject.transform.position.y, scene.items[select].gameObject.transform.position.z);
                scene.yes_no[1].gameObject.transform.position = new Vector3(scene.items[select].gameObject.transform.position.x + float.Parse("0.5"), scene.items[select].gameObject.transform.position.y, scene.items[select].gameObject.transform.position.z);
            }
            break;

        case State.SECOND_STATE:     // Tsai: Use enumeration to define states
            int result2 = Array.IndexOf(scene.yes_no, other.gameObject);
            if (result2 == 0)
            {
                scene.YesOrNo.SetActive(false);
                foreach (GameObject it in scene.yes_no)
                {
                    it.SetActive(false);
                }
                //record.selectObject(other.gameObject, stage, hint);
                if (ans == select)
                {
                    state = State.THIRDSTATE;
                    scene.wellDone.SetActive(true);
                    menuButton.SetActive(true);
                    prompt = true;
                    break;
                }
                else
                {
                    /*switch(stage)
                     * {
                     *  case SceneMenu.Stage.WHAT_IS_SHE_LOOKINH_AT:
                     *      stage1();
                     *      break;
                     *  case SceneMenu.Stage.HOW_DEOS_SHE_FEEL_ABOUT:
                     *      stage2();
                     *      break;
                     * }*/
                    switch (hint)
                    {
                    case Hint.ARROW:         // Tsai: Use enumeration to define states
                        scene.hints[0].SetActive(true);
                        scene.instruction.SetActive(true);
                        if (ansObj.transform.position.x > scene.NPC.transform.position.x)
                        {
                            scene.arrowL.SetActive(true);
                        }
                        else if (ansObj.transform.position.x < scene.NPC.transform.position.x)
                        {
                            scene.arrowR.SetActive(true);
                        }
                        hint  = Hint.FINGER;
                        state = State.FIRST_STATE;
                        break;

                    case Hint.FINGER:         // Tsai: Use enumeration to define states
                        scene.hints[1].SetActive(true);
                        scene.instruction.SetActive(true);
                        hint  = Hint.FLICKER;
                        state = State.FIRST_STATE;
                        if (target.transform.position.x < scene.NPC.transform.position.x)
                        {
                            interactionSystem.StartInteraction(FullBodyBipedEffector.LeftHand, target, interrupt);
                        }
                        else
                        {
                            interactionSystem.StartInteraction(FullBodyBipedEffector.RightHand, target, interrupt);
                        }
                        break;

                    case Hint.FLICKER:         // Tsai: Use enumeration to define states
                        scene.hints[2].SetActive(true);
                        scene.instruction.SetActive(true);
                        hint  = Hint.End;
                        state = State.FIRST_STATE;
                        h3    = true;
                        break;

                    case Hint.End:         // Tsai: Use enumeration to define states
                        menuButton.SetActive(true);
                        state = State.THIRDSTATE;
                        break;
                    }
                }
            }
            else if (result2 == 1)
            {
                scene.YesOrNo.SetActive(false);
                foreach (GameObject it in scene.yes_no)
                {
                    it.SetActive(false);
                }
                state = State.FIRST_STATE;
            }
            else
            {
                state = State.SECOND_STATE;
            }
            break;

        case State.THIRDSTATE:     // Tsai: Use enumeration to define states

            if (other.gameObject == menuButton.gameObject)
            {
                SceneMenu.menu   = SceneMenu.Menu.MAIN_MENU;
                SceneMenu.change = true;
            }

            masteryCriterion++;
            record.Mastery_Critirion(masteryCriterion);
            record.Frequency((int)frequency);
            switch (frequency)
            {
            case Frequency.FIRST:
                if (!prompt)
                {
                    correct[0]++;
                }

                if (masteryCriterion == 20)
                {
                    masteryCriterion = 0;
                    if (correct[0] == 20)
                    {
                        stage = SceneMenu.Stage.HOW_DEOS_SHE_FEEL_ABOUT;
                        return;
                    }
                    frequency = Frequency.SECOND;
                }
                break;

            case Frequency.SECOND:
                if (!prompt)
                {
                    correct[1]++;
                }

                if (masteryCriterion == 20)
                {
                    masteryCriterion = 0;
                    frequency        = Frequency.FIRST;
                    if (correct[0] >= 18 && correct[1] >= 18)
                    {
                        stage = SceneMenu.Stage.HOW_DEOS_SHE_FEEL_ABOUT;
                        return;
                    }
                    correct[0] = 0;
                    correct[1] = 0;
                }
                break;
            }

            break;
        }
    }