BotNavSim  v0.4.3
Mobile Robot Simulation
BotLoader Class Reference

Bot loader provides functions for finding and loading robots. More...

Static Public Member Functions

static void SearchForRobots ()
 Searchs for robots. More...
 
static Robot LoadRobot (int index)
 Load a robot by index in robotsFound list. More...
 
static Robot LoadRobot (string name)
 Loads a robot from robotsFound list by name. More...
 
static Robot RandomRobot ()
 Loads a random robot from the robotsFound list. More...
 
static string RandomRobotName ()
 Returns a random robot name from the robotsFound list. More...
 

Static Public Attributes

static List< GameObject > robotsFound = new List<GameObject>()
 List of robots found in the Robots/ resources directory More...
 

Detailed Description

Bot loader provides functions for finding and loading robots.

Definition at line 8 of file BotLoader.cs.

Member Function Documentation

static Robot BotLoader.LoadRobot ( int  index)
static

Load a robot by index in robotsFound list.

Returns
The robot.
Parameters
indexIndex.

Definition at line 34 of file BotLoader.cs.

34  {
35  Transform robot = robotsFound[index].transform.Spawn();
36  return robot.GetComponent<Robot>();
37  }
Robot class bridges the gap between sensors and INavigation. The navigation direction is cached in Ro...
Definition: Robot.cs:11
static List< GameObject > robotsFound
List of robots found in the Robots/ resources directory
Definition: BotLoader.cs:13

Here is the caller graph for this function:

static Robot BotLoader.LoadRobot ( string  name)
static

Loads a robot from robotsFound list by name.

Returns
The robot.
Parameters
nameName.

Definition at line 44 of file BotLoader.cs.

44  {
45  foreach (GameObject r in robotsFound) {
46  if (r.name == name) {
47  Transform robot = r.transform.Spawn();
48  return robot.GetComponent<Robot>();
49  }
50  }
51  Debug.LogError(name + " robot not found.");
52  return null;
53  }
Robot class bridges the gap between sensors and INavigation. The navigation direction is cached in Ro...
Definition: Robot.cs:11
static List< GameObject > robotsFound
List of robots found in the Robots/ resources directory
Definition: BotLoader.cs:13
static Robot BotLoader.RandomRobot ( )
static

Loads a random robot from the robotsFound list.

Returns
The robot.

Definition at line 59 of file BotLoader.cs.

59  {
61  int index = Random.Range(0, robotsFound.Count);
62  return LoadRobot(index);
63  }
static void SearchForRobots()
Searchs for robots.
Definition: BotLoader.cs:19
static Robot LoadRobot(int index)
Load a robot by index in robotsFound list.
Definition: BotLoader.cs:34
static List< GameObject > robotsFound
List of robots found in the Robots/ resources directory
Definition: BotLoader.cs:13

Here is the call graph for this function:

static string BotLoader.RandomRobotName ( )
static

Returns a random robot name from the robotsFound list.

Returns
The robot name.

Definition at line 69 of file BotLoader.cs.

69  {
71  int index = Random.Range(0, robotsFound.Count);
72  return robotsFound[index].name;
73  }
static void SearchForRobots()
Searchs for robots.
Definition: BotLoader.cs:19
static List< GameObject > robotsFound
List of robots found in the Robots/ resources directory
Definition: BotLoader.cs:13

Here is the call graph for this function:

Here is the caller graph for this function:

static void BotLoader.SearchForRobots ( )
static

Searchs for robots.

Definition at line 19 of file BotLoader.cs.

19  {
20  robotsFound.Clear();
21  GameObject[] robots = Resources.LoadAll<GameObject>("Robots/");
22  foreach (GameObject r in robots) {
23  if (r.GetComponent<Robot>()) {
24  robotsFound.Add(r);
25  }
26  }
27  }
Robot class bridges the gap between sensors and INavigation. The navigation direction is cached in Ro...
Definition: Robot.cs:11
static List< GameObject > robotsFound
List of robots found in the Robots/ resources directory
Definition: BotLoader.cs:13

Here is the caller graph for this function:

Member Data Documentation

List<GameObject> BotLoader.robotsFound = new List<GameObject>()
static

List of robots found in the Robots/ resources directory

Definition at line 13 of file BotLoader.cs.


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