void PlaceTree(ProgressBar bar) { bar.Reset(); bar.SetText("Spawn Tree and cactus"); bar.SetMaxValue(_vectree.Count); foreach (Vector2 vec in _vectree) { if (ReferenceEquals(MapBiomes[(int)vec.X], ArrayResource.Desrt)) { var height = Rand.Next(2, 5); for (var i = 0; i < height; i++) { SetTexture((int)vec.X, (int)vec.Y - i, 28); } SetTexture((int)vec.X, (int)vec.Y - height, 28, 1); } else { AddTree((int)vec.X, (int)vec.Y); } bar.Add(1); } if (Program.Game.CurrentDimension != 1) { StructuresList.Add(new Home(0, MapHeight[5], true)); } }
// Use this for initialization void Start() { _main = GetComponent <Main>(); _assnetwork = GameObject.Find("Network").GetComponent <ASSNetwork>(); _slicer = GetComponent <Slicer>(); _loader = GetComponent <SliceLoader>(); _sList = GetComponent <StructuresList>(); _currentVolume = "none"; _drawing = false; _enabled = true; }
void GeneratorCaves(int i) { for (var j = SizeGeneratior.RockLayer; j < SizeGeneratior.WorldHeight; j++) { var airspawn = Rand.Next(0, 800); if (airspawn == 0 && Program.Game.CurrentDimension != 1) { StructuresList.Add(new Caves(i, j)); } } }
// Use this for initialization void Start() { _instance = this; _loader = GetComponent <SliceLoader>(); _slicer = GetComponent <Slicer>(); _sList = GetComponent <StructuresList>(); _eraser = GetComponent <Eraser>(); _mouseHistory = new List <MouseSnapshot>(); _mouseVelocity = Vector2.zero; _mouseDelta = Vector2.zero; }
private void SelfParse() { string comment = ""; for (int index = 0; index < TextData.Count; index++) { var line = TextData[index]; if (line.TrimStart().StartsWith("///")) { comment += line; continue; } var match = RegexHelpers.MethodRegex.Match(line); if (match.Success) // method found { int brackets = line.Count(x => x == '{') - line.Count(x => x == '}'); int j = index + 1; do { line = TextData[j]; brackets += line.Count(x => x == '{'); brackets -= line.Count(x => x == '}'); j++; } while (j < TextData.Count && brackets > 0); index = j; var data = new MethodData(match.Value, comment, header.FullName); StructuresList.Add(data); comment = ""; } match = RegexHelpers.PropertyRegex.Match(line); if (match.Success) { int brackets = line.Count(x => x == '{') - line.Count(x => x == '}'); int j = index + 1; do { line = TextData[j]; brackets += line.Count(x => x == '{'); brackets -= line.Count(x => x == '}'); j++; } while (j < TextData.Count && brackets > 0); index = j; var data = new PropertyData(match.Value, comment); StructuresList.Add(data); comment = ""; } } TextData = null; }
void GeneratorHomeAndFactory(ProgressBar bar, int i) { if (i + 9 >= SizeGeneratior.WorldWidth || MapHeight[i] != MapHeight[i + 9]) { return; } if (Rand.Next(0, 20) == 0 && ReferenceEquals(MapBiomes[i], ArrayResource.Grass) || Rand.Next(0, 60) == 0 && ReferenceEquals(MapBiomes[i], ArrayResource.Desrt) ) { if (StructuresList.Count >= 1) { var test = false; for (var structureId = StructuresList.Count - 1; structureId > 0; structureId--) { if (!(StructuresList[structureId] is Home home)) { continue; } test = true; if (i > home.X + 15) { StructuresList.Add(new Home(i, MapHeight[i])); } break; } if (!test) { StructuresList.Add(new Home(i, MapHeight[i])); } } else if (i > 15) { StructuresList.Add(new Home(i, MapHeight[i])); } } else if (Program.Game.CurrentDimension == 0 && Rand.NextDouble() <= 0.5f) { if (_factory == null && i >= 40 && i < SizeGeneratior.WorldWidth - 40) { _factory = new Factory(i, MapHeight[i]); } } }
internal override void AfterLoad(World world) { base.AfterLoad(world); _worldConstructionSearch = new WorldConstructionsList(World); _structureSearch = new StructuresList(World); var structures = from structure in World.Structures orderby structure.Type.GetDescription() group structure by structure.Type.GetDescription() into structuretype select structuretype; var worldconstructions = from construction in World.WorldConstructions orderby construction.Type.GetDescription() group construction by construction.Type.GetDescription() into constructiontype select constructiontype; cmbStructureType.Items.Add("All"); cmbStructureType.SelectedIndex = 0; foreach (var structure in structures) { cmbStructureType.Items.Add(structure.Key); } cmbConstructionType.Items.Add("All"); cmbConstructionType.SelectedIndex = 0; foreach (var construction in worldconstructions) { cmbConstructionType.Items.Add(construction.Key); } var worldConstructionEvents = from eventType in World.WorldConstructions.SelectMany(element => element.Events) group eventType by eventType.Type into type select type.Key; var structureEvents = from eventType in World.Structures.SelectMany(element => element.Events) group eventType by eventType.Type into type select type.Key; _siteSearch = new SitesList(World); var sites = from site in World.Sites where !string.IsNullOrWhiteSpace(site.Name) orderby site.Type group site by site.Type into sitetype select sitetype; var populationTypes = from population in World.SitePopulations orderby population.Race group population by population.Race into type select type; cmbSiteType.Items.Add("All"); cmbSiteType.SelectedIndex = 0; foreach (var site in sites) { cmbSiteType.Items.Add(site.Key); } cmbSitePopulation.Items.Add("All"); cmbSitePopulation.SelectedIndex = 0; foreach (var populationType in populationTypes) { cmbSitePopulation.Items.Add(populationType.Key); } var siteEvents = from eventType in World.Sites.SelectMany(site => site.Events) group eventType by eventType.Type into type select type.Key; TabEvents.Clear(); TabEvents.Add(siteEvents.ToList()); TabEvents.Add(structureEvents.ToList()); TabEvents.Add(worldConstructionEvents.ToList()); }