public Improbable.Controller.NoFlyZone GetNoFlyZone() { Improbable.Collections.List <Vector3f> positions = new Improbable.Collections.List <Vector3f>(); for (int i = 0; i < nfzNodes.Length; i++) { positions.Add(nfzNodes[i].transform.position.ToSpatialVector3f()); } return(NFZ_Templates.CreateCustomNoFlyZone(positions)); }
public static Entity CreateControllerTemplate(Improbable.Coordinates spawnPoint, Vector3f topLeft, Vector3f bottomRight, NFZTemplate[] templates, List <Improbable.Controller.DroneInfo> droneSlots) { List <Improbable.Controller.NoFlyZone> nfzs = new List <Improbable.Controller.NoFlyZone>(); foreach (NFZTemplate template in templates) { nfzs.Add(NFZ_Templates.GetNoFlyZone(template)); } return(CreateControllerTemplate(spawnPoint, topLeft, bottomRight, nfzs, droneSlots)); }
//[MenuItem("Improbable/Snapshots/Generate Phase 1 Snapshot - 1 BASIC")] //private static void GeneratePhase1SnapshotDev() //{ // var snapshotEntities = new Dictionary<EntityId, Entity>(); // var currentEntityId = 1; // NFZTemplate[] nfzTemplates = { // NFZTemplate.BASIC_SQUARE // }; // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateControllerTemplate( // new Coordinates(0, 0, 0), // new Vector3f(-1000, 0, 1000), // new Vector3f(1000, 0, -1000), // nfzTemplates // )); // currentEntityId = DisplayNoFlyZones(nfzTemplates, snapshotEntities, currentEntityId); // SaveSnapshot(snapshotEntities, "phase1/basic/square"); //} //[MenuItem("Improbable/Snapshots/Generate Phase 1 Snapshot - 2 RECTANGLE")] //private static void GeneratePhase1SnapshotDev2() //{ // var snapshotEntities = new Dictionary<EntityId, Entity>(); // var currentEntityId = 1; // NFZTemplate[] nfzTemplates = { // NFZTemplate.BASIC_RECTANGLE // }; // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateControllerTemplate( // new Coordinates(0, 0, 0), // new Vector3f(-1000, 0, 1000), // new Vector3f(1000, 0, -1000), // nfzTemplates // )); // currentEntityId = DisplayNoFlyZones(nfzTemplates, snapshotEntities, currentEntityId); // SaveSnapshot(snapshotEntities, "phase1/basic/rectangle"); //} //[MenuItem("Improbable/Snapshots/Generate Phase 1 Snapshot - 3 ENCLOSURE V1")] //private static void GeneratePhase1SnapshotDev3() //{ // var snapshotEntities = new Dictionary<EntityId, Entity>(); // var currentEntityId = 1; // NFZTemplate[] nfzTemplates = { // NFZTemplate.BASIC_ENCLOSURE // }; // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateControllerTemplate( // new Coordinates(0, 0, 0), // new Vector3f(-1000, 0, 1000), // new Vector3f(1000, 0, -1000), // nfzTemplates // )); // currentEntityId = DisplayNoFlyZones(nfzTemplates, snapshotEntities, currentEntityId); // Coordinates spawn = new Coordinates(0, 0, -125); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // new Vector3f(0, 0, 150),new EntityId(1), // 50, snapshot:true) // ); // SaveSnapshot(snapshotEntities, "phase1/basic/enclosure"); //} //[MenuItem("Improbable/Snapshots/Generate Phase 2 Snapshot - 1 ENCLOSURE V2")] //private static void GeneratePhase1SnapshotDev3v2() //{ // var snapshotEntities = new Dictionary<EntityId, Entity>(); // var currentEntityId = 1; // NFZTemplate[] nfzTemplates = { // NFZTemplate.BASIC_ENCLOSURE // }; // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateControllerTemplate( // new Coordinates(0, 0, 0), // new Vector3f(-1000, 0, 1000), // new Vector3f(1000, 0, -1000), // nfzTemplates // )); // currentEntityId = DisplayNoFlyZones(nfzTemplates, snapshotEntities, currentEntityId); // Coordinates spawn = new Coordinates(0, 0, -56); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // new Vector3f(0, 0, 150),new EntityId(1), // 50, // snapshot:true) // ); // spawn = new Coordinates(300, 0, 300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(),new EntityId(1), // 50) // ); // spawn = new Coordinates(300, 0, -300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1)) // ); // spawn = new Coordinates(-300, 0, -300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1)) // ); // spawn = new Coordinates(-300, 0, 300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1)) // ); // SaveSnapshot(snapshotEntities, "phase2/basic/enclosure2"); //} //[MenuItem("Improbable/Snapshots/Generate Phase 2 Snapshot - 2 ENCLOSURE V3")] //private static void GeneratePhase1SnapshotDev3v3() //{ // var snapshotEntities = new Dictionary<EntityId, Entity>(); // var currentEntityId = 1; // NFZTemplate[] nfzTemplates = { // NFZTemplate.BASIC_ENCLOSURE // }; // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateControllerTemplate( // new Coordinates(0, 0, 0), // new Vector3f(-1000, 0, 1000), // new Vector3f(1000, 0, -1000), // nfzTemplates // )); // currentEntityId = DisplayNoFlyZones(nfzTemplates, snapshotEntities, currentEntityId); // Coordinates spawn = new Coordinates(0, 0, -125); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // new Vector3f(0, 0, 150), new EntityId(1), // 50, snapshot:true) // ); // spawn = new Coordinates(300, 0, 300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(),new EntityId(1), // 50, delay:5) // ); // spawn = new Coordinates(300, 0, -300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1), // delay: 10) // ); // spawn = new Coordinates(-300, 0, -300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1), // delay: 15) // ); // spawn = new Coordinates(-300, 0, 300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1), // delay: 20) // ); // spawn = new Coordinates(0, 0, 300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1), // delay: 25) // ); // spawn = new Coordinates(0, 0, -300); // snapshotEntities.Add( // new EntityId(currentEntityId++), // EntityTemplateFactory.CreateDroneTemplate( // spawn, // spawn.ToSpatialVector3f(), new EntityId(1), // delay: 30) // ); // SaveSnapshot(snapshotEntities, "phase2/basic/enclosure3"); //} public static int DisplayNoFlyZone(NFZTemplate template, Dictionary <EntityId, Entity> snapshotEntities, int currentEntityId) { float[] points = NFZ_Templates.getPoints(template); for (int i = 0; i < points.Length; i += 2) { snapshotEntities.Add( new EntityId(currentEntityId++), EntityTemplateFactory.CreateNfzNodeTemplate(new Coordinates(points[i], 0, points[i + 1])) ); } return(currentEntityId); }