示例#1
0
 /// <summary>
 /// This method is responsible for recording data about agent trajectory to be sent to the server
 /// </summary>
 /// <returns></returns>
 private IEnumerator Recording()
 {
     if (rP)
     {
         while (inGameSession)
         {
             float x = FixingRound(transform.position.x / squareSize);
             float z = FixingRound(transform.position.z / squareSize);
             rP.SavePosNum((int)x, (int)z, transform.eulerAngles);
             yield return(new WaitForSeconds(1f));
         }
         float finishingTime = Time.time;
         rP.SaveTimeNum(finishingTime - startingTime + previousTime);
         timeCompletion = finishingTime - startingTime + previousTime;
         Debug.Log(finishingTime - startingTime + previousTime);
         rP.PreparingForServer();
     }
 }
示例#2
0
    /// <summary>
    /// This method allows to save map information and robot trajectory information on files. When the simulation is ended (the goal is reached), these content
    /// is saved on a dedicated server
    /// </summary>
    /// <returns></returns>
    protected IEnumerator SavingProgress()
    {
        while (rM.inGameSession)
        {
            if (!isNumeric)
            {
                rP.SaveMapChar(robot_map);
            }
            else
            {
                rP.SaveMapNum(numeric_robot_map);
            }

            robotX = FixingRound(transform.position.x / squareSize);
            robotZ = FixingRound(transform.position.z / squareSize);

            if (!isNumeric)
            {
                rP.SavePosChar((int)robotX, (int)robotZ, transform.eulerAngles);
            }
            else
            {
                rP.SavePosNum((int)robotX, (int)robotZ, transform.eulerAngles);
            }

            yield return(new WaitForSeconds(1f));
        }

        finishingTime = Time.time;

        if (!isNumeric)
        {
            rP.SaveTimeChar(finishingTime - startingTime);
        }
        else
        {
            rP.SaveTimeNum(finishingTime - startingTime);
        }

        //rP.PreparingForServer();
        finished = true;
    }