Example #1
0
        private void Initialize()
        {
            _editableImageConstraint = new TycoonTileConstraint2i();
            _sampler = new DualImageSampler2i();

            _terrainGenerator = new TerrainGenerator2i <TerrainMesher2i>();
            _meshUpdater      = new TerrainMeshUpdater();
            _groupsSelector   = new GroupsByCameraVisibilitySelector();
            _imageProvider    = new EditableMatrixImage2i(InitialTexture, InitialTextureScale, _sampler, _editableImageConstraint);
        }
Example #2
0
        public SceneContext(
            IGroupSelector groupSelector,
            ITerrainGenerator2i terrainGenerator,
            IMeshUpdater meshUpdater,
            Vector3 cameraPosition,
            IReadOnlyList <Plane> cameraPlanes,
            IReadOnlyPooledList <Vector3> cameraFrustumCorners,
            Matrix4x4 cameraLocalToWorldMatrix,
            Matrix4x4 parentContainerWorldToLocalMatrix,
            IReadOnlySet <Vector2i> existingGroups,
            Vector2i cellInGroupCount,
            IImage2i image,
            Rect2i invalidatedArea_imageSpace,
            IImageSampler2i imageSampler,
            Func <GameObject> gameObjectFactory,
            ProfilerFactoryDelegate profilerFactory,
            LoggerFactoryDelegate loggerFactory)
        {
            GroupSelector                     = groupSelector;
            TerrainGenerator                  = terrainGenerator;
            MeshUpdater                       = meshUpdater;
            CameraPosition                    = cameraPosition;
            CameraPlanes                      = cameraPlanes;
            CameraFrustumCorners              = cameraFrustumCorners;
            CameraLocalToWorldMatrix          = cameraLocalToWorldMatrix;
            ParentContainerWorldToLocalMatrix = parentContainerWorldToLocalMatrix;
            ExistingGroups                    = existingGroups;
            CellInGroupCount                  = cellInGroupCount;
            Image             = image;
            ImageSampler      = imageSampler;
            GameObjectFactory = gameObjectFactory;
            ProfilerFactory   = profilerFactory;
            LoggerFactory     = loggerFactory;

            RangeZ      = image.RangeZ;
            GroupBounds = new Bounds(new Vector3(CellInGroupCount.x / 2.0f, CellInGroupCount.y / 2.0f, RangeZ.Center), new Vector3(CellInGroupCount.x, CellInGroupCount.y, RangeZ.Size));
            InvalidatedArea_worldSpace = ImageSampler
                                         .ImageToWorld(invalidatedArea_imageSpace)
                                         .RoundToContain();

            (Image as IInitializableImage)?.StartUsing();
        }
Example #3
0
        private void DisposeService()
        {
            (_imageProvider as IDisposable)?.Dispose();
            _imageProvider = null;

            (_editableImageConstraint as IDisposable)?.Dispose();
            _editableImageConstraint = null;

            (_sampler as IDisposable)?.Dispose();
            _sampler = null;

            (_terrainGenerator as IDisposable)?.Dispose();
            _terrainGenerator = null;

            (_meshUpdater as IDisposable)?.Dispose();
            _meshUpdater = null;

            (_groupsSelector as IDisposable)?.Dispose();
            _groupsSelector = null;
        }
Example #4
0
 public VkService(IGroupSelector vkGroupSelector, IVkPhotoWorker photoPostManager)
 {
     _vkGroupSelector = vkGroupSelector;
     _photoPoster     = photoPostManager;
 }