예제 #1
0
 void ClickCalPath()
 {
     inforBrg.setAutoGenerateStates(true);
     roomLoc.getStartingPoint(new Vector3(44f, 2f, 138.7f));
     roomLoc.getEndingPoint(new Vector3(44f, 2f, 138.7f));
     Application.LoadLevel("CCNYGrove");
 }
예제 #2
0
    void Confirm()
    {
        if (selectLevel != null)
        {
            /*string path = Application.persistentDataPath + "/LevleSave.json";
             *
             * string jsonString = File.ReadAllText (path);
             * Debug.Log (jsonString);
             * json = (JSONNode)JSON.Parse (jsonString);*/
            Debug.Log("Level selection" + selectLevel);
            Debug.Log(json [selectLevel] ["Start"] [0] [0].AsFloat);
            Debug.Log(json [selectLevel] ["End"].Count);
            //rand = (int)Random.Range (0, json ["Level One"] ["End"].Count);

            startPos.x = json [selectLevel] ["Start"] [numberOfItem - 1] [0].AsFloat;
            startPos.y = json [selectLevel] ["Start"] [numberOfItem - 1] [1].AsFloat;
            startPos.z = json [selectLevel] ["Start"] [numberOfItem - 1] [2].AsFloat;
            endPos.x   = json [selectLevel] ["End"] [numberOfItem - 1] [0].AsFloat;
            endPos.y   = json [selectLevel] ["End"] [numberOfItem - 1] [1].AsFloat;
            endPos.z   = json [selectLevel] ["End"] [numberOfItem - 1] [2].AsFloat;
            Debug.Log(startPos);
            Debug.Log(endPos);


            roomLoc.getStartingPoint(startPos);
            roomLoc.getEndingPoint(endPos);
            Application.LoadLevel("CCNYGrove");
        }
        else
        {
            inforBrg.setAutoGenerateStates(true);
            roomLoc.getStartingPoint(new Vector3(44f, 2f, 138.7f));
            roomLoc.getEndingPoint(new Vector3(44f, 2f, 138.7f));
            Application.LoadLevel("CCNYGrove");
        }
    }
예제 #3
0
    void ClickOne()
    {
        EasyTTSUtil.SpeechAdd("Level one");
        s = "Level One";
        if (isGenerate)
        {
            /*string path = Application.persistentDataPath + "/LevleSave.json";
             *
             * string jsonString = File.ReadAllText (path);
             * Debug.Log (jsonString);
             * json = (JSONNode)JSON.Parse (jsonString);*/
            Debug.Log("Level one");
            Debug.Log(json ["Level One"] ["Start"] [0] [0].AsFloat);
            Debug.Log(json ["Level One"] ["End"].Count);
            rand = (int)Random.Range(0, json ["Level One"] ["End"].Count);

            startPos.x = json ["Level One"] ["Start"] [rand] [0].AsFloat;
            startPos.y = json ["Level One"] ["Start"] [rand] [1].AsFloat;
            startPos.z = json ["Level One"] ["Start"] [rand] [2].AsFloat;
            endPos.x   = json ["Level One"] ["End"] [rand] [0].AsFloat;
            endPos.y   = json ["Level One"] ["End"] [rand] [1].AsFloat;
            endPos.z   = json ["Level One"] ["End"] [rand] [2].AsFloat;
            Debug.Log(startPos);
            Debug.Log(endPos);


            roomLoc.getStartingPoint(startPos);
            roomLoc.getEndingPoint(endPos);
            Application.LoadLevel("CCNYGrove");
        }
        else
        {
            roomLoc.getStartingPoint(new Vector3(44f, 2f, 138.7f));
            roomLoc.getEndingPoint(new Vector3(-62.6f, 2f, 168.5f));
            Application.LoadLevel("CCNYGrove");
        }
    }
예제 #4
0
    void Start()
    {
        EasyTTSUtil.Initialize(EasyTTSUtil.UnitedStates);

        gameController = gameObject.GetComponent <GameController1> ();
        Button one     = levelOne.GetComponent <Button> ();
        Button two     = levelTwo.GetComponent <Button> ();
        Button three   = levelThree.GetComponent <Button> ();
        Button four    = levelFour.GetComponent <Button> ();
        Button confirm = confirmButton.GetComponent <Button> ();
        Button back    = backButton.GetComponent <Button>();
        Text   lvone   = numLevelOne.GetComponent <Text> ();
        Text   lvtwo   = numLevelTwo.GetComponent <Text> ();
        Text   lvthree = numLevelThree.GetComponent <Text> ();
        Text   lvfour  = numLevelFour.GetComponent <Text> ();


        inforBrg  = new TheInformationBridge();
        selection = 0;



        /*string path = Application.persistentDataPath + "/LevleSave.json";
         *
         * string jsonString = File.ReadAllText (path);
         * Debug.Log (jsonString);
         * json = (JSONNode)JSON.Parse (jsonString);*/
        roomLoc = new RoomLocationsConf();

        try
        {
            //EasyTTSUtil.SpeechAdd("try to catch the exception");
            inforBrg.setAutoGenerateStates(false);
            string path = Application.persistentDataPath + "/LevleSave.json";
            //EasyTTSUtil.SpeechAdd("one");
            string jsonString = "";
            //if (platform == RuntimePlatform.WindowsEditor || platform == RuntimePlatform.WindowsPlayer)
            jsonString = File.ReadAllText(path);

            /*if (platform == RuntimePlatform.OSXEditor || platform == RuntimePlatform.OSXPlayer)
             *      jsonString = File.ReadAllText (path);
             * if (platform == RuntimePlatform.Android || platform == RuntimePlatform.IPhonePlayer){
             *      TextAsset jsonTxt = (TextAsset)Resources.Load("LevleSave",typeof(JSON));
             *      jsonString = jsonTxt.text;
             * }*/
            //EasyTTSUtil.SpeechAdd("two");
            //Debug.Log (jsonString);
            json = (JSONNode)JSON.Parse(jsonString);

            print(json ["Level One"] ["End"].Count + ".");

            lvone.text   = json ["Level One"] ["End"].Count + ".";
            lvtwo.text   = json ["Level two"] ["End"].Count + ".";
            lvthree.text = json ["Level three"] ["End"].Count + ".";
            lvfour.text  = json ["Level four"] ["End"].Count + ".";
        }catch (FileNotFoundException e)
        {
            //EasyTTSUtil.SpeechAdd("catch the exceptoption");
            inforBrg.setAutoGenerateStates(true);
            roomLoc.getStartingPoint(new Vector3(44f, 2f, 138.7f));
            roomLoc.getEndingPoint(new Vector3(44f, 2f, 138.7f));
            Application.LoadLevel("CCNYGrove");
        }



        selectNum.onEndEdit.AddListener(SelectNumber);
        one.onClick.AddListener(ClickOne);
        two.onClick.AddListener(ClickTwo);
        three.onClick.AddListener(ClickThree);
        four.onClick.AddListener(ClickFour);
        confirm.onClick.AddListener(Confirm);
        back.onClick.AddListener(ClickBack);
    }