Instance Red/Blue agents through script at runtime.
Instance Red/Blue agents through script at runtime.
Refer to the script examples below.
Globals.api = ApiSystemMono.CreateApiSystemMono();
//now we will create some characters in this case soldiers, one on the blue team aka friend and one on the red team aka the enemy
Rideid blueAgent = Globals.api.agentSystem.AddAgent(Ride.Team.Blue, new RideVector3(-1, 0, 0));
Rideid redAgent = Globals.api.agentSystem.AddAgent(Ride.Team.Red, new RideVector3(1, 0, 0));
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
UnityEngine.SceneManagement.SceneManager.LoadScene("LevelSelect");
}
if (Input.GetMouseButtonDown(1)) // right click
{
Ray r = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(r, out hit))
{
IEnumerable agents = Globals.api.viewSystem.selectedAgents;
Globals.api.movementSystem.MoveToPosition(agents, hit.point, FormationProcedureType.Cluster);
}
}
}