Exemple #1
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);
        }