Exemplo n.º 1
0
 public Land(LandLayout layout, ILandSettings settings)
 {
     _settings = settings;
     _zones = layout.Zones.Select(z => new Zone(z)).ToArray();
     Layout = layout;
     _idwCoeff = settings.IDWCoeff;
     _idwOffset = settings.IDWOffset;
     _zoneMaxType = settings.ZoneTypes.Max(z => z.Type);
     _zoneTypesCount = _zones.Where(z => z.Type != ZoneType.Empty).Distinct(Zone.TypeComparer).Count();
     _zoneSettings = settings.ZoneTypes.ToArray();
     _chunksBounds = new Bounds2i(settings.LandBounds.Min/(settings.BlocksCount*settings.BlockSize),
         settings.LandBounds.Max/(settings.BlocksCount*settings.BlockSize));
 }
Exemplo n.º 2
0
 public Land(LandLayout layout, ILandSettings settings)
 {
     _settings       = settings;
     _zones          = layout.Zones.Select(z => new Zone(z)).ToArray();
     Layout          = layout;
     _idwCoeff       = settings.IDWCoeff;
     _idwOffset      = settings.IDWOffset;
     _zoneMaxType    = settings.ZoneTypes.Max(z => z.Type);
     _zoneTypesCount = _zones.Where(z => z.Type != ZoneType.Empty).Distinct(Zone.TypeComparer).Count();
     _zoneSettings   = settings.ZoneTypes.ToArray();
     _chunksBounds   = new Bounds2i(settings.LandBounds.Min / (settings.BlocksCount * settings.BlockSize),
                                    settings.LandBounds.Max / (settings.BlocksCount * settings.BlockSize));
 }
        protected ZoneGenerator(ZoneLayout zone, [NotNull] LandLayout land, [NotNull] ILandSettings landSettings)
        {
            if (land == null) throw new ArgumentNullException("land");
            if (landSettings == null) throw new ArgumentNullException("landSettings");

            _zone = zone;
            Land = land;
            _landSettings = landSettings;
            _blocksCount = landSettings.BlocksCount;
            _blockSize = landSettings.BlockSize;
            _chunkSize = _blocksCount*_blockSize;
            _zoneMaxType = landSettings.ZoneTypes.Max(z => z.Type);
            DefaultBlock = landSettings.ZoneTypes.First(z => z.Type == zone.Type).DefaultBlock;
        }
Exemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (Application.isPlaying && _target != null)
            {
                if (GUILayout.Button("Rebuild land"))
                {
                    _target.BuildAll();
                    _layout = _main.LandLayout;
                }

                if (GUILayout.Button("Create map"))
                {
                    var map = _main.GenerateMap(_target);
                    _target.MeshAndVisualize(map);
                }
            }
        }
 public LandGenerator(LandLayout land, ILandSettings settings)
 {
     _land = land;
     _settings = settings;
 }
 public HillsGenerator(ZoneLayout zone, LandLayout land, ILandSettings landSettings) : base(zone, land, landSettings)
 {
 }
 public DefaultGenerator(ZoneLayout zone, LandLayout land, ILandSettings landSettings) : base(zone, land, landSettings)
 {
     
 }
Exemplo n.º 8
0
 public LandMap(ILandSettings settings, LandLayout layout)
 {
     _settings = settings;
     Layout = layout;
 }
Exemplo n.º 9
0
 void OnEnable()
 {
     if (Application.isPlaying)
     {
         _target = (Runner)target;
         _main = _target.Main;
         _layout = _main.LandLayout;
         _self = this;
     }
 }