Пример #1
0
    /// <summary>
    /// Loads the environment.
    /// </summary>
    /// <param name="name">Name.</param>
    private static void LoadEnvironment(string name)
    {
        EnvLoader.SearchForEnvironments();
        if (environment)
        {
            environment.transform.Recycle();
        }
        environment      = EnvLoader.LoadEnvironment(name);
        environment.name = name;         // avoids: Unity appending "(Clone)" to instance names
        Debug.Log(environment);
        Bounds b = new Bounds();

        foreach (Renderer r in environment.GetComponentsInChildren <Renderer>())
        {
            b.Encapsulate(r.bounds);
        }
        Instance.bounds = b;
        CamController.SetViewMode(CamController.ViewMode.Birdseye);
    }
Пример #2
0
 /// <summary>
 /// Halt current simulation.
 /// Load the next simulation in batch, or
 ///  change state to State.end if at the end of batch.
 /// </summary>
 public static void NextSimulation()
 {
     // stop current simulation
     if (state == State.simulating)
     {
         Halt(StopCode.Unspecified);
     }
     // next in batch
     simulationNumber++;
     if (simulationNumber > batch.Count)
     {
         // end of batch
         Halt(StopCode.Unspecified);
         End();
         return;
     }
     Debug.Log("Simulation NextSimulation: " + simulationNumber + " of " + batch.Count);
     // load simulation settings
     settings = batch[simulationNumber - 1];
     Log.Settings();
     // load environment
     EnvLoader.SearchForEnvironments();
     environment = EnvLoader.LoadEnvironment(settings.environmentName);
     destination.transform.position = RandomInBounds(Instance.bounds);
     // load robot
     if (robot)
     {
         CamController.RemoveAreaOfInterest(robot);
     }
     BotLoader.SearchForRobots();
     robot            = BotLoader.LoadRobot(settings.robotName);
     robot.navigation = NavLoader.LoadPlugin(settings.navigationAssemblyName);
     // configure camera
     CamController.AddAreaOfInterest(robot);
     CamController.SetViewMode(CamController.ViewMode.Birdseye);
     CamController.SetAreaOfInterest(robot);
     // reset test number
     testNumber = 0;
     NextTest();
 }