Exemplo n.º 1
0
        void CreateUnits()
        {
            _units = new Unit[PlanetConfig.UnitSize, PlanetConfig.UnitSize];
            GeoRange rect = Surface.Rect / PlanetConfig.UnitSize;

            for (int x = 0; x < PlanetConfig.UnitSize; x++)
            {
                GeoRange tmpRect = rect;
                for (int y = 0; y < PlanetConfig.UnitSize; y++)
                {
                    _units[x, y] = CreateUnit(cfg, new Vector2Int(x, y), rect, this, ZoomLevel + 1);

                    rect = rect.NextBottom();
                }
                rect = tmpRect.NextRight();
            }
        }
Exemplo n.º 2
0
        void CreatePlanetUnits()
        {
            _units = new Unit[PlanetConfig.UnitSize, PlanetConfig.UnitSize / 2];
            GeoRange rect = new GeoRange(Surface.Rect.Start, Surface.Rect.Width / PlanetConfig.UnitSize, 2 * Surface.Rect.Height / PlanetConfig.UnitSize);

            for (int x = 0; x < PlanetConfig.UnitSize; x++)
            {
                GeoRange tmpRect = rect;
                for (int y = 0; y < PlanetConfig.UnitSize / 2; y++)
                {
                    _units[x, y] = CreateUnit(cfg, new Vector2Int(x, y), rect, this, ZoomLevel + 1);

                    rect = rect.NextBottom();
                }
                rect = tmpRect.NextRight();
            }
        }