BotNavSim  v0.4.3
Mobile Robot Simulation
EnvLoader Class Reference

Environment loader searches for and loads environment GameObjects from the Unity Resources folder. More...

Static Public Member Functions

static void SearchForEnvironments ()
 Searchs for environments. More...
 
static GameObject LoadEnvironment (string name)
 Loads the environment. More...
 
static GameObject RandomEnvironment ()
 Loads a random environment. More...
 
static string RandomEnvironmentName ()
 Selects a random environment name. More...
 

Static Public Attributes

static List< GameObject > environmentsFound = new List<GameObject>()
 

Detailed Description

Environment loader searches for and loads environment GameObjects from the Unity Resources folder.

Definition at line 9 of file EnvLoader.cs.

Member Function Documentation

static GameObject EnvLoader.LoadEnvironment ( string  name)
static

Loads the environment.

Returns
The environment.
Parameters
nameName.

Definition at line 29 of file EnvLoader.cs.

29  {
30  foreach (GameObject e in environmentsFound) {
31  if (e.name == name) {
32  Transform env = e.transform.Spawn();
33  env.position = e.transform.position;
34  return env.gameObject;
35  }
36  }
37  Debug.LogError(name + " environment not found.");
38  return null;
39  }
static List< GameObject > environmentsFound
Definition: EnvLoader.cs:11

Here is the caller graph for this function:

static GameObject EnvLoader.RandomEnvironment ( )
static

Loads a random environment.

Returns
The environment.

Definition at line 45 of file EnvLoader.cs.

45  {
47  int index = Random.Range(0, environmentsFound.Count);
48  return environmentsFound[index];
49  }
static List< GameObject > environmentsFound
Definition: EnvLoader.cs:11
static void SearchForEnvironments()
Searchs for environments.
Definition: EnvLoader.cs:16

Here is the call graph for this function:

static string EnvLoader.RandomEnvironmentName ( )
static

Selects a random environment name.

Returns
The environment name.

Definition at line 55 of file EnvLoader.cs.

55  {
57  int index = Random.Range(0, environmentsFound.Count);
58  return environmentsFound[index].name;
59  }
static List< GameObject > environmentsFound
Definition: EnvLoader.cs:11
static void SearchForEnvironments()
Searchs for environments.
Definition: EnvLoader.cs:16

Here is the call graph for this function:

Here is the caller graph for this function:

static void EnvLoader.SearchForEnvironments ( )
static

Searchs for environments.

Definition at line 16 of file EnvLoader.cs.

16  {
17  environmentsFound.Clear();
18  GameObject[] envs = Resources.LoadAll<GameObject>("Environments/");
19  foreach (GameObject e in envs) {
20  environmentsFound.Add(e);
21  }
22  }
static List< GameObject > environmentsFound
Definition: EnvLoader.cs:11

Here is the caller graph for this function:

Member Data Documentation

List<GameObject> EnvLoader.environmentsFound = new List<GameObject>()
static

Definition at line 11 of file EnvLoader.cs.


The documentation for this class was generated from the following file: