Exemple #1
0
        //[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);
        }
Exemple #2
0
    public static Improbable.Controller.NoFlyZone GetNoFlyZone(NFZTemplate template)
    {
        Improbable.Controller.NoFlyZone nfz = new Improbable.Controller.NoFlyZone();
        nfz.vertices = new Improbable.Collections.List <Improbable.Vector3f>();

        float[] coords = getPoints(template);
        for (int i = 0; i < coords.Length; i += 2)
        {
            nfz.vertices.Add(new Improbable.Vector3f(coords[i], 0, coords[i + 1]));
        }

        NoFlyZone.setBoundingBoxCoordinates(ref nfz);

        return(nfz);
    }
Exemple #3
0
    public static float[] getPoints(NFZTemplate template)
    {
        switch (template)
        {
        case NFZTemplate.RIGHT_RECTANGLE:
            return(rightRectangle);

        case NFZTemplate.TOP_LEFT_SQUARE:
            return(topLeftSquare);

        case NFZTemplate.BASIC_ENCLOSURE:
            return(basicEnclosure);

        case NFZTemplate.BASIC_RECTANGLE:
            return(basicRectangle);

        case NFZTemplate.BASIC_SQUARE:
        default:
            return(basicSquare);
        }
    }