Example #1
0
 public ScrollableCameraController(Rect paneSize, RectTransform image, Camera camera, int worldSize, WorldmapPointerController pointerController)
 {
     this.paneSize          = paneSize;
     this.camera            = camera;
     this.worldSize         = worldSize;
     this.pointerController = pointerController;
     defineCameraBounds();
 }
Example #2
0
        public void drawWorld(WorldMap worldMap)
        {
            clear();
            this.worldMap = worldMap;
            worldSize     = worldMap.size;
            pointer.gameObject.SetActive(true);
            Vector3 bounds = new Vector3(worldSize * tileSize, worldSize * tileSize, 0);

            pointerController = new WorldmapPointerController(worldSize, pointer);
            controller        = new ScrollableCameraController(mask.rect, image, _camera, worldSize, pointerController);

            Vector3Int cachePosition = new Vector3Int();

            for (int x = 0; x < worldSize; x++)
            {
                for (int y = 0; y < worldSize; y++)
                {
                    cachePosition.Set(x, y, 0);
                    tilemap.SetTile(cachePosition, tileBases[Random.Range(0, tileBases.Length - 1)]);
                }
            }
            updateHintText();
        }