Esempio n. 1
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());

            // create the planets
            for (uint i = 0; i < 9; ++i)
            {
                snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlanetTemplate(i));
            }

            // create the asteroid belt
            for (int i = 0; i < 1000; ++i)
            {
                float angle = Random.Range(-180f, 180f);

                // asteroids are in a belt that's from 2 to 3.2 AU from the sun
                double orbitRadius = Random.Range(2.0f, 3.2f) * Scales.au2km;

                // TODO: make this a distribution where most are near 1 km in size but a tiny few can be as large as 100 km
                double diameter = Random.Range(10000f, 60000f);

                snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateAsteroidTemplate(angle, orbitRadius, diameter));
            }

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 2
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());

            float startX = -142.5f, startZ = -142.5f;

            for (int i = 0; i < 20; ++i)
            {
                for (int j = 0; j < 20; ++j)
                {
                    snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTileTemplate(new Vector3(startX + i * 15f, 0, startZ + j * 15f)));
                }
            }

            // Inner circle
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTankTemplate(new Vector3(-5, 0, -5)));


            for (int i = 1; i < 10; ++i)
            {
                Vector3 posVector = Vector3.forward * 15 * i;
                snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTankTemplate(Quaternion.Euler(0, Random.Range(1, 90), 0) * posVector));
                snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTankTemplate(Quaternion.Euler(0, Random.Range(91, 180), 0) * posVector));
                snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTankTemplate(Quaternion.Euler(0, Random.Range(181, 270), 0) * posVector));
                snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTankTemplate(Quaternion.Euler(0, Random.Range(271, 360), 0) * posVector));
            }

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 3
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeTemplate());

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 4
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());
            PopulateSnapshotWithWeaponBoxContainerEntities(ref snapshotEntities, ref currentEntityId);
            PopulateSnapshotWithSpeedBoostBoxContainerEntities(ref snapshotEntities, ref currentEntityId);
            PopulateSnapshotWithHPBoxContainerEntities(ref snapshotEntities, ref currentEntityId);
            SaveSnapshot(snapshotEntities);
        }
Esempio n. 5
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());
            PopulateSnapshotWithIslandTerrainEntities(ref snapshotEntities, ref currentEntityId);
            PopulateSnapshotWithSmallFishGroups(ref snapshotEntities, ref currentEntityId);
            PopulateSnapshotWithLargeFish(ref snapshotEntities, ref currentEntityId);

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 6
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateBananaCreatorTemplate());
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeTemplate());
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateLaboratoryTemplate());
//			snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateBananaTemplate());
//			PopulateSnapshotWithBananaEntities(ref snapshotEntities, ref currentEntityId);

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 7
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());

            string helpNotice = "Arrow Keys: Movement\nSpace: Jump\nHold Shift: Swing Sword";

            snapshotEntities.Add(
                new EntityId(currentEntityId++),
                EntityTemplateFactory.CreateNoticeTemplate(helpNotice, new Improbable.Coordinates(0, 1f, 0)));

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 8
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            var islandEntityId = new EntityId(currentEntityId++);

            snapshotEntities.Add(islandEntityId, EntityTemplateFactory.CreateIslandTemplate(0, 0, "Greenish Land"));

            var playerCreatorPlatformPosition = new PlatformPosition.Data(new Vector3f(0.0f, 0.0f, 0.0f), islandEntityId);

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate(playerCreatorPlatformPosition));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateShipTemplate(-5, 25, 0, "SS McBoatFace"));

            SaveSnapshot(snapshotEntities);
        }
Esempio n. 9
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            Debug.Log("generate");

            var entities = FindObjectsOfType <EntityTemplate>()
                           .Select(t => t.gameObject.GetComponent <EntityTemplate>().EntityBuilder().Build());


            snapshotEntities = entities.ToDictionary(e => new EntityId(currentEntityId++));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());
            //snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeTemplate());
            //snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateRampa1Template());
            SaveSnapshot(snapshotEntities);
        }
Esempio n. 10
0
        public IDictionary <EntityId, Entity> Build(ISnapshot snapshot)
        {
            Debug.LogFormat("Building..");

            var entities        = new Dictionary <EntityId, Entity>();
            var currentEntityId = 1;

            entities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());

            AddVehicles(ref currentEntityId, entities, snapshot);

            if (snapshot.HasTrafficLight)
            {
                var position = new Vector3(SimulationSettings.TrackRadius + 2f, 0f, 0f);
                var data     = new TrafficLightData(0, 8f, 2f, 20f, 2f);
                entities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateTrafficLightTemplate(position, Quaternion.Euler(0f, 180f, 0f), data));
            }

            return(entities);
        }
        private static void GenerateDefaultSnapshot()
        {
            var snapshotEntities = new Dictionary <EntityId, Entity>();
            var currentEntityId  = 1;

            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate());

            // Test Cubes
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeEntityTemplate(new Coordinates(4, 1, 0)));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeEntityTemplate(new Coordinates(-4, 1, 0)));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeEntityTemplate(new Coordinates(0, 1, 4)));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeEntityTemplate(new Coordinates(0, 1, -4)));

            // Armchairs
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateArmchairEntityTemplate(new Coordinates(-2, 0, -2), 45));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateArmchairEntityTemplate(new Coordinates(-2, 0, 2), 135));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateArmchairEntityTemplate(new Coordinates(2, 0, 2), 225));
            snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateArmchairEntityTemplate(new Coordinates(2, 0, -2), 315));

            SaveSnapshot(snapshotEntities);
        }