Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        Application.targetFrameRate = 77;
        QualitySettings.vSyncCount  = 0;

        // Initialize the player
        EasyTTSUtil.Initialize(EasyTTSUtil.UnitedStates);               // text to speech
        //EasyTTSUtil.OpenTTSSetting ();
        //playerRigidbody = GetComponent<Rigidbody>();
        infoBrg = new TheInformationBridge();
        agent   = GetComponent <NavMeshAgent> ();
        source  = GetComponent <AudioSource> ();
        rlc     = new RoomLocationsConf();

        playerStartingPoint = rlc.setStartingPoint();
        start = "0,0,0";
        //"Not defined yet";
        end = "0,0,0";
        //"Not defined yet";

        colTime        = Time.timeSinceLevelLoad;
        myCols         = new ArrayList();
        countColli     = 0;
        countWrongStep = 0;
        endOfGame      = false;
        isMoving       = false;
        interTime      = 1.0f;
        restartTime    = 0.0f;
        instruct       = "";
        nearBy         = "";
        nearByQueue    = new string[3];
        source.clip    = footSteps;
        source.volume  = 1f;
        firstTimeHit   = 0;

        correctDirection = "";
        accessDirection  = "";
        isAllowMove      = true;
        isReachTarget    = false;
        trackPosition    = new string[2];
        justTurned       = false;
        frameCount       = 1;

        if (collisionText != null)
        {
            collisionText.text = "Collision count: " + countColli.ToString();
        }
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        EasyTTSUtil.Initialize(EasyTTSUtil.UnitedStates);

        nextDir       = new NextDirection();
        rlc           = new RoomLocationsConf();
        infoBrg       = new TheInformationBridge();
        curVal        = 0;
        startPoint    = rlc.setStartingPoint();
        endPoint      = rlc.setEndingPoint();
        agent.enabled = false;
        isFeet        = false;

        player.transform.position = rlc.setStartingPoint();
        //Debug.Log (player.position+"********************");
        //player.transform.rotation = ;
        nextDir.setStart(rlc.setStartingPoint());
        target.transform.position = rlc.setEndingPoint();

        agent.enabled = true;


        path = agent.path;

        //nextDirection = "";
        crntDirection = "";
        fourDir       = " ";

        //degree = 0;           No longer used to get next direction to way point

        numWayPoint = path.corners.Length;
        elapsed     = 0;

        isAutoGerneratePath = infoBrg.getAutoGenerateStates();
        if (isAutoGerneratePath)
        {
            SaveJson();
        }
        curMsg = "constantly redefined";
        difMsg = "redefined only is curmsg changes";
        //Debug.Log (player.position+"++++++++");
        //for (int i = 0; i < path.corners.Length; i++)
        //Debug.Log (path.corners[i]);
        calculatePath();
        adjustDirection();
        summary();


        /*
         * if (isAutoGerneratePath) {
         *      if (rooms == null)
         *              rooms = GameObject.FindGameObjectsWithTag ("Door");
         *      //Debug.Log (rooms.Length);
         *      roomPosition = new Vector3[rooms.Length];
         *      int i = 0;
         *      foreach (GameObject room in rooms) {
         *              roomPosition [i] = new Vector3(room.transform.position.x, 2f, room.transform.position.z);
         *              Debug.Log (roomPosition[i]);
         *              i++;
         *      }
         *
         *
         *      Vector3[] a = new Vector3[2];
         *      for(int j = 0; j < roomPosition.Length; j++){
         *              for(int k = 0; k < roomPosition.Length; k++){
         *                      if(j != k){
         *                              Debug.Log ("start: " + roomPosition[j] + "End: " + roomPosition[k]);
         *
         *                              Debug.Log (totalRoomPassedBy (roomPosition[j],roomPosition[k]) + " rooms pass by. "
         + totalPossibleTurn (roomPosition[j],roomPosition[k]) + " turns include."
         + DifficultWeight (roomPosition[j],roomPosition[k]) + " turn weight."
         + totalDistance(roomPosition[j],roomPosition[k]) + " Distance."
         + (totalRoomPassedBy (roomPosition[j],roomPosition[k]) * 2 + totalPossibleTurn (roomPosition[j],roomPosition[k])* 2
         + DifficultWeight (roomPosition[j],roomPosition[k]) * 10 + totalDistance(roomPosition[j],roomPosition[k])*0.1) + " DIfficutly.");
         +
         +                              difficulty = totalRoomPassedBy(roomPosition[j],roomPosition[k]) * 2
         + totalPossibleTurn(roomPosition[j],roomPosition[k]) * 2
         + DifficultWeight(roomPosition[j],roomPosition[k]) * 10
         + (totalDistance(roomPosition[j],roomPosition[k]) * 0.1);
         +
         +                              //Debug.Log (difficulty);
         +                              if(difficulty < 20 && difficulty >= 0){
         +                                      Debug.Log ("add success");
         +                                      levelOne.Add(a);
         +                                      //Debug.Log ("add success");
         +                              }
         +                              if(difficulty < 50 && difficulty >= 20){
         +                                      levelTwo.Add(a);
         +                              }
         +                              if(difficulty < 80 && difficulty >= 50){
         +                                      levelThree.Add(a);
         +                              }
         +                              if(difficulty >= 80){
         +                                      levelFour.Add(a);
         +                              }
         +
         +                      }
         +
         +              }
         +      }
         +      //json.Add ("Level one", levelOne.ToArray());
         +
         +      //Debug.Log(levelOne);
         +
         +      //for (int j = 0; j < roomPosition.Length; j++)
         +      //Debug.Log (roomPosition[j]);
         + }*/
    }