private void SpawnGroupTwo() { var orangeUnits = InstantiateUnits(3, 0); var greenUnits = InstantiateUnits(0, 3); //You can also create groups from already existing lists var grpOrange = GroupingManager.CreateGroup(orangeUnits); var grpGreen = GroupingManager.CreateGroup(greenUnits); grpOrange.MoveTo(target.position, false); grpGreen.MoveTo(target.position, false); }
private void Start() { //Get the waypoint transforms var waypoints = this.GetComponentsInChildren <Transform>().Skip(1).ToArray(); //Create the orange group. In this example we just create an empty grouping and add members to it var grpOrange = GroupingManager.CreateGrouping <IUnitFacade>(); for (int i = 0; i < 20; i++) { var agent = Spawn(this.orangeMold, waypoints[0].position); grpOrange.Add(agent); } IFormation formation = new FormationGrid(1.5f); grpOrange.SetFormation(formation); for (int i = 1; i < 10; i++) { grpOrange.MoveTo(waypoints[i % waypoints.Length].position, true); } //Create the green group. var grpGreen = GroupingManager.CreateGroup <IUnitFacade>(9); for (int i = 0; i < 9; i++) { var agent = Spawn(this.greenMold, waypoints[3].position); grpGreen.Add(agent); } formation = new FormationEllipsoid(1.5f); grpGreen.SetFormation(formation); for (int i = 2; i > -10; i--) { var idx = Math.Abs((i + waypoints.Length) % waypoints.Length); grpGreen.MoveTo(waypoints[idx].position, true); } //Spawn a solo unit var solo = Spawn(this.blueMold, waypoints[4].position); for (int i = 0; i < 17; i++) { solo.MoveTo(waypoints[i % waypoints.Length].position, true); } }
private void SpawnGroupOne() { //Here we simply create a groups manually, which will be the most common for AI units var grpOrange = GroupingManager.CreateGroup <IUnitFacade>(3); var grpGreen = GroupingManager.CreateGroup <IUnitFacade>(3); for (int i = 0; i < 3; i++) { var go = Instantiate(this.orangeMold, Vector3.zero, Quaternion.identity) as GameObject; grpOrange.Add(go.GetUnitFacade()); go = Instantiate(this.greenMold, Vector3.zero, Quaternion.identity) as GameObject; grpGreen.Add(go.GetUnitFacade()); } grpOrange.MoveTo(target.position, false); grpGreen.MoveTo(target.position, false); }