public async Task <IActionResult> OnGetAsync(string city, string country) { City = city.Titleize(); Country = country.Titleize(); var cyanometerDataSource = CyanometerDataSources.Default.GetData(city, country); if (cyanometerDataSource == null) { logger.LogWarning($"Couldn't find source {country}/{city}"); return(NotFound()); } string key = $"air_pollution_for_{country}/{city}"; var service = airQualityServiceFactory.GetService(cyanometerDataSource.AirQualitySource); AirQualitySource = service.DataSourceInfo; AirQualityLink = service.DataSourceUri; AirQualityPollutionCalculated calculated = await memoryCache.GetOrCreateAsync(key, async entry => { var rawPollution = await service.GetIndexAsync(cyanometerDataSource.AirQualityLocation, CancellationToken.None); calculated = airQualityProcessor.Calculate(rawPollution); entry.SetAbsoluteExpiration(DateTimeOffset.Now.AddMinutes(15)); return(calculated); }); PollutionMeasurement = calculated.PollutionWeight != AirPollution.Low ? calculated.ChiefPollutant.ToString(): "LOW"; PollutionColor = calculated.PollutionWeight switch { AirPollution.Low => "72B22F", AirPollution.Mid => "FEF10D", AirPollution.High => "F17E19", AirPollution.VeryHigh => "E4001C", _ => "" }; PollutionText = calculated.PollutionWeight switch { AirPollution.Low => "LOW", AirPollution.Mid => "MODERATE", AirPollution.High => "HIGH", AirPollution.VeryHigh => "VERY HIGH", _ => "UNKNOWN" }; LevelsText = calculated.ChiefPollutant switch { Measurement.NO2 => "NITROGEN DIOXIDE", Measurement.SO2 => "SULFUR DIOXIDE", Measurement.O3 => "OZONE", Measurement.PM10 => "PARTICLES", _ => "" }; Pollution = new Pollution( FromDouble(calculated.Data.O3), FromDouble(calculated.Data.PM10), FromDouble(calculated.Data.SO2), FromDouble(calculated.Data.NO2) ); return(Page()); } int?FromDouble(double?value) => value.HasValue ? (int?)Convert.ToInt32(value.Value): null; }
//method used for copying Sectorstatistics without reference public SectorStatistics(SectorStatistics sectorStatistics) { income = sectorStatistics.income; happiness = sectorStatistics.happiness; ecoAwareness = sectorStatistics.ecoAwareness; prosperity = sectorStatistics.prosperity; pollution = new Pollution(sectorStatistics.pollution); }
//method used for copying Pollution without reference public Pollution(Pollution pollution) { avgPollution = 0; airPollution = pollution.airPollution; naturePollution = pollution.naturePollution; waterPollution = pollution.waterPollution; airPollutionIncrease = pollution.airPollutionIncrease; naturePollutionIncrease = pollution.naturePollutionIncrease; waterPollutionIncrease = pollution.waterPollutionIncrease; }
IEnumerator LateCall() { yield return(new WaitForSeconds(waitForSecondsBeforeStart)); gameTime = 0f; earth.SetActive(true); pollution = GetComponent <Pollution>(); ResetTreeCutCounter(); InitialSpawn(); yield return(null); }
public clValue(decimal value, Well well, Pollution pollution, ValueNorm valueNorm = null, CalculationFormula calculationFormula = null, CoefficientValue coefficientValue = null, PriceNorm priceNorm = null) { this.Value = Math.Round(value, pollution.Round, MidpointRounding.AwayFromZero); this.Pollution = pollution; this.Well = well; this.ValueNorm = valueNorm; this.CoefficientValue = coefficientValue; this.CalculationFormula = calculationFormula; this.PriceNorm = priceNorm; }
private void OnTriggerStay2D(Collider2D other) { _isHitting = true; if (timer < Time.time - pastTime) { if (other.CompareTag("Meteor")) { pollution = other.gameObject.GetComponent <Pollution>(); if (pollution == null) { Debug.Log("WaterFlow has no reference to Pullution in meteor"); } pollution.GetDamage(givenDamageToMeteors); } } }
private WrapPanel LoadBox(Pollution pollution) { WrapPanel WP = new WrapPanel(); foreach (var one in PollutionBase_Class.AllCalculationFormul.Where(x => x.PollutionID == pollution.ID).Select(x => Helpers.LogicHelper.CalculationFormulaLogic.FirstModel(x.ID))) { WP.Children.Add(one.GetEditor ( SFE, new MyTools.C_DefColumn(C.CalculationFormula.Pollution, size, false), new MyTools.C_DefColumn(C.CalculationFormula.ResolutionClarify, size), new MyTools.C_DefColumn(C.CalculationFormula.YM, size), new MyTools.C_DefColumn(C.CalculationFormula.Number, size), new MyTools.C_DefColumn(C.CalculationFormula.GettingValueFormula, size), new MyTools.C_DefColumn(C.CalculationFormula.Formula, size, false, -1, new System.Windows.Input.MouseButtonEventHandler((sender, e) => { new FormulaCreator_Window(one).ShowDialog(); })), new MyTools.C_DefColumn(C.CalculationFormula.GettingValueLink, size), new MyTools.C_DefColumn(C.CalculationFormula.Label, size) )); Rectangle rec = new Rectangle(); rec.Stroke = Brushes.Aqua; (WP.Children[WP.Children.Count - 1] as Grid).SetFromGrid(rec, 0, 0, int.MaxValue, int.MaxValue); } Button BT = new Button(); BT.Content = "Добавить"; BT.Click += (sender, e) => { selectPollution = TC.SelectedIndex; G.CalculationFormula.QUERRY() .ADD .C(C.CalculationFormula.Pollution, pollution.ID) .DO(); LoadTC(EViewType.Pollution); TC.SelectedIndex = selectPollution; }; WP.Children.Add(BT); return(WP); }
public override string ToString() { return("Wealth=" + Wealth.ToString() + "\n" + "Wealth=" + Police.ToString() + "\n" + "Wealth=" + Heterogenity.ToString() + "\n" + "Wealth=" + Pollution.ToString() + "\n" + "Wealth=" + Corruption.ToString() + "\n\n" + "Wealth=" + Infrastructure.ToString() + "\n" + "Wealth=" + HealthServices.ToString() + "\n" + "Wealth=" + Crime.ToString() + "\n" + "Wealth=" + Religion.ToString() + "\n" + "Wealth=" + Food.ToString() + "\n" + "Wealth=" + Cleanness.ToString() + "\n" + "Wealth=" + Employment.ToString() + "\n" + "Wealth=" + Information.ToString() + "\n\n" + "Wealth=" + Nourishment.ToString() + "\n" + "Wealth=" + Health.ToString() + "\n" + "Wealth=" + Shelter.ToString() + "\n" + "Wealth=" + Trust.ToString() + "\n" + "Wealth=" + Safety.ToString()); }
public void AddGarbageToLocation(Vector3 pos, Pollution.PollutionType polType) { if (polType > 0) { polType = (Pollution.PollutionType)Random.Range(-1, (int)polType); if (polType >= 0) { GameObject tempInstantiate; switch (polType) { case Pollution.PollutionType.salt: tempInstantiate = Instantiate(salt, pos, Quaternion.identity) as GameObject; break; case Pollution.PollutionType.oil: tempInstantiate = Instantiate(oil, pos, Quaternion.identity) as GameObject; break; case Pollution.PollutionType.sand: tempInstantiate = Instantiate(sand, pos, Quaternion.identity) as GameObject; break; case Pollution.PollutionType.rock: tempInstantiate = Instantiate(rock, pos, Quaternion.identity) as GameObject; break; case Pollution.PollutionType.lumber: tempInstantiate = Instantiate(lumber, pos, Quaternion.identity) as GameObject; break; default: tempInstantiate = null; break; } if (tempInstantiate) { SpawnManager.AddPollutantToArray(tempInstantiate); } } } }
private normPage LoadNorm(Pollution polution, Well well, int row) { normPage normPage = new normPage(); normPage.Set621(polution.ID, well); normPage.Set644(polution.ID, well); if (normPage._621 != null) { table.value.Add(new MyTools.C_ValueCell($"{(polution.HasRange ? $"{normPage._621.FromRound}-" : "")}{normPage._621.ToRound}", row + 2, 3 + MonthCount, style: style[0])); } else { table.value.Add(new MyTools.C_ValueCell("", row + 2, 3 + MonthCount, style: style[0])); } if (normPage._644 != null) { table.value.Add(new MyTools.C_ValueCell($"{(polution.HasRange ? $"{normPage._644.FromRound}-" : "")}{normPage._644.ToRound}", row + 2, 4 + MonthCount, style: style[1])); } else { table.value.Add(new MyTools.C_ValueCell("", row + 2, 4 + MonthCount, style: style[1])); } return(normPage); }
public void TakeDamage(Pollution.PollutionType type) { switch(type) { case Pollution.PollutionType.oil: saltHealth -= 1; break; case Pollution.PollutionType.sand: saltHealth -= 2; break; case Pollution.PollutionType.rock: saltHealth -= 3; break; case Pollution.PollutionType.lumber: saltHealth -= 4; break; } if(saltHealth <= 0) { saltHealth = 0; StartCoroutine(TurnOffSalt()); } }
private void Start() { pollution = FindObjectOfType <Pollution>(); }
/// <summary>Отрисовка таблицы</summary> public void CreateTable(ICell cell, SelectionWell selectionWell) { table = CreateColumn(cell); for (int i = 1; i < 16; i++) { table.value.Add(new MyTools.C_ValueCell(i, 1, i - 1)); } table.value.Add(new MyTools.C_ValueCell("мг / л", 0, 6)); table.value.Add(new MyTools.C_ValueCell("мг / л", 0, 7)); table.value.Add(new MyTools.C_ValueCell("мг / л", 0, 10)); table.value.Add(new MyTools.C_ValueCell("тонн", 0, 8)); table.value.Add(new MyTools.C_ValueCell("тонн", 0, 9)); table.value.Add(new MyTools.C_ValueCell("тонн", 0, 11)); ValueSelection[] valueSelections = selectionWell.ValueSelections.Where(x => x.Value > 0).ToArray(); table.value.Add(new MyTools.C_ValueCell(MyTools.StringDate_From_YMDHMS(selectionWell.YMDHM, MyTools.EInputDate.YMDHM, MyTools.EInputDate.YMD), 2, 0, valueSelections.Length - 1)); MonthVolume = obj.GetMidMonthVolume(DateControl_Class.SelectYear - 1).Volume; table.value.Add(new MyTools.C_ValueCell(MonthVolume, 2, 1, valueSelections.Length - 1)); int row = 2; Declaration declair = selectionWell.Well.Declaration; foreach (var valueSelection in valueSelections) { Pollution pollution = valueSelection.Pollution; table.value.Add(new MyTools.C_ValueCell(pollution.FullName.TextToUpper().StringDivision(4), row, 2, style: Styles.s_RLTB_LC_T10_W)); if (pollution.Key > 0) { table.value.Add(new MyTools.C_ValueCell(pollution.Key, row, 3)); } table.value.Add(new MyTools.C_ValueCell(valueSelection.ValueRound.KillZero(), row, 4)); table.value.Add(new MyTools.C_ValueCell(((decimal)MonthVolume * valueSelection.Value).ToMath(6, 4, 1), row, 5, style: Styles.s_RLTB_RC_T10_W)); table.value.AddRange(GetResolution(valueSelection, "621", row, 6, 8, 12)); table.value.AddRange(GetResolution(valueSelection, "644", row, 7, 9, 13)); DeclarationValue declarationValue = declair != null?declair.DeclarationValues.FirstOrDefault(x => x.PollutionID == pollution.ID) : null; if (declarationValue != null) { decimal result = 0; if (pollution.HasRange) { table.value.Add(new MyTools.C_ValueCell($"{declarationValue.FromRound.KillZero()}-{declarationValue.ToRound.KillZero()}", row, 10)); } else { table.value.Add(new MyTools.C_ValueCell(declarationValue.ToRound.KillZero(), row, 10)); result = (decimal)MonthVolume * declarationValue.To; if (result > 0) { table.value.Add(new MyTools.C_ValueCell(result.ToMath(6, 4, 1), row, 11, style: Styles.s_RLTB_RC_T10_W)); } result = Math.Round(valueSelection.Value / declarationValue.To, 1); if (result > 1) { table.value.Add(new MyTools.C_ValueCell(result.ToMoney(null, 1), row, 14)); } } } row++; } CreateTable(cell.Sheet, table); ResizeWidth(cell.Sheet, MyTools.ETypeFormatBook.Horizontal, table); ResizeHeight(cell.Sheet, table); }
public async Task Post(Pollution pollution) { _session.Execute("INSERT INTO pollution_data (sensorid, sensordata, collecttime) VALUES ('" + pollution.SensorId + "', " + pollution.SensorData + ", " + pollution.CollectTime + ")"); }
public static void moodizeGrid(Pollution.StatusColor.Status status, string station) { Random rand = new Random(); StatusColor statusAtributes = new StatusColor(status); tileCollection.ElementAt(24).blankTile(statusAtributes.getBrush()); tileCollection.ElementAt(24).mainStatusTile(station, statusAtributes.getBrush(), statusAtributes.getUri()); foreach (Canvas tile in tileCollection) { if (tile.Name == "blankTile") { tile.Background = statusAtributes.getBrush(); tile.Opacity = ((double)(rand.Next(50, 100))) / 100; } } }
public void Awake() { pollutionReference = FindObjectOfType <Pollution>(); trees = transform.GetChild(0).gameObject; StopParticles(); }
private void Start() { pollution = GetComponent <Pollution>(); maxPollution = pollution.GetMaxPollution(); }
public SectorStatistics() { pollution = new Pollution(); }
// Start is called before the first frame update void Start() { Pollution = new Pollution(); CreateLevel(); }
void Awake() { pollution = FindObjectOfType <Pollution>(); }
public static Bitmap MapTileGraphicC2(int xC2, int yC2) => MapTileGraphic[(((xC2 + 2 * Map.Instance.Xdim) % (2 * Map.Instance.Xdim)) - yC2 % 2) / 2, yC2]; // Return tile graphics for civ2-coords input // Extract icon from civ2.exe file //public static void ImportCiv2Icon() //{ // try // { // Civ2Icon = Icon.ExtractAssociatedIcon(Settings.Civ2Path + "civ2.exe"); // } // catch // { // Debug.WriteLine("Civ2.exe not found!"); // } //} public static void TerrainBitmapsImportFromFile(string path) { // Read file in local directory. If it doesn't exist there, read it in root civ2 directory. var terrain1 = new Bitmap(640, 480, PixelFormat.Format32bppRgba); //var terrain1 = new Image<Rgba32>(640, 480); string FilePath_local = path + Path.DirectorySeparatorChar + "TERRAIN1.GIF"; string FilePath_root = Settings.Civ2Path + "TERRAIN1.GIF"; if (File.Exists(FilePath_local)) { terrain1 = new Bitmap(FilePath_local); } else if (File.Exists(FilePath_root)) { terrain1 = new Bitmap(FilePath_root); } else { Debug.WriteLine("TERRAIN1.GIF not found!"); } var terrain2 = new Bitmap(640, 480, PixelFormat.Format32bppRgba); FilePath_local = path + Path.DirectorySeparatorChar + "TERRAIN2.GIF"; FilePath_root = Settings.Civ2Path + "TERRAIN2.GIF"; if (File.Exists(FilePath_local)) { terrain2 = new Bitmap(FilePath_local); } else if (File.Exists(FilePath_root)) { terrain2 = new Bitmap(FilePath_root); } else { Debug.WriteLine("TERRAIN2.GIF not found!"); } // Initialize objects Desert = new Bitmap[4]; Plains = new Bitmap[4]; Grassland = new Bitmap[4]; ForestBase = new Bitmap[4]; HillsBase = new Bitmap[4]; MtnsBase = new Bitmap[4]; Tundra = new Bitmap[4]; Glacier = new Bitmap[4]; Swamp = new Bitmap[4]; Jungle = new Bitmap[4]; Ocean = new Bitmap[4]; Coast = new Bitmap[8, 4]; River = new Bitmap[16]; Forest = new Bitmap[16]; Mountains = new Bitmap[16]; Hills = new Bitmap[16]; RiverMouth = new Bitmap[4]; Road = new Bitmap[9]; Railroad = new Bitmap[9]; // Define transparent colors Color transparentGray = Color.FromArgb(135, 135, 135); // Define transparent back color (gray) Color transparentPink = Color.FromArgb(255, 0, 255); // Define transparent back color (pink) Color transparentCyan = Color.FromArgb(0, 255, 255); // Define transparent back color (cyan) // Tiles for (int i = 0; i < 4; i++) { Desert[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), 1, 64, 32)); Desert[i].ReplaceColors(transparentGray, Colors.Transparent); Desert[i].ReplaceColors(transparentPink, Colors.Transparent); Plains[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (2 * 1) + (1 * 32), 64, 32)); Plains[i].ReplaceColors(transparentGray, Colors.Transparent); Plains[i].ReplaceColors(transparentPink, Colors.Transparent); Grassland[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (3 * 1) + (2 * 32), 64, 32)); Grassland[i].ReplaceColors(transparentGray, Colors.Transparent); Grassland[i].ReplaceColors(transparentPink, Colors.Transparent); ForestBase[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (4 * 1) + (3 * 32), 64, 32)); ForestBase[i].ReplaceColors(transparentGray, Colors.Transparent); ForestBase[i].ReplaceColors(transparentPink, Colors.Transparent); HillsBase[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (5 * 1) + (4 * 32), 64, 32)); HillsBase[i].ReplaceColors(transparentGray, Colors.Transparent); HillsBase[i].ReplaceColors(transparentPink, Colors.Transparent); MtnsBase[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (6 * 1) + (5 * 32), 64, 32)); MtnsBase[i].ReplaceColors(transparentGray, Colors.Transparent); MtnsBase[i].ReplaceColors(transparentPink, Colors.Transparent); Tundra[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (7 * 1) + (6 * 32), 64, 32)); Tundra[i].ReplaceColors(transparentGray, Colors.Transparent); Tundra[i].ReplaceColors(transparentPink, Colors.Transparent); Glacier[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (8 * 1) + (7 * 32), 64, 32)); Glacier[i].ReplaceColors(transparentGray, Colors.Transparent); Glacier[i].ReplaceColors(transparentPink, Colors.Transparent); Swamp[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (9 * 1) + (8 * 32), 64, 32)); Swamp[i].ReplaceColors(transparentGray, Colors.Transparent); Swamp[i].ReplaceColors(transparentPink, Colors.Transparent); Jungle[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (10 * 1) + (9 * 32), 64, 32)); Jungle[i].ReplaceColors(transparentGray, Colors.Transparent); Jungle[i].ReplaceColors(transparentPink, Colors.Transparent); Ocean[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (11 * 1) + (10 * 32), 64, 32)); Ocean[i].ReplaceColors(transparentGray, Colors.Transparent); Ocean[i].ReplaceColors(transparentPink, Colors.Transparent); } // 4 small dither tiles DitherBlank = new Bitmap[2, 2]; DitherDots = new Bitmap[2, 2]; for (int tileX = 0; tileX < 2; tileX++) { for (int tileY = 0; tileY < 2; tileY++) { DitherBlank[tileX, tileY] = terrain1.Clone(new Rectangle((tileX * 32) + 1, (tileY * 16) + 447, 32, 16)); DitherDots[tileX, tileY] = DitherBlank[tileX, tileY]; DitherDots[tileX, tileY].ReplaceColors(transparentGray, Colors.Transparent); DitherDots[tileX, tileY].ReplaceColors(transparentPink, Colors.Transparent); } } // Blank tile Blank = terrain1.Clone(new Rectangle(131, 447, 64, 32)); Blank.ReplaceColors(transparentGray, Colors.Transparent); // Dither base (only useful for grasland?) DitherBase = terrain1.Clone(new Rectangle(196, 447, 64, 32)); // Replace black dither pixels with base pixels DitherDesert = new Bitmap[2, 2]; // 4 dither tiles for one 64x32 map tile DitherPlains = new Bitmap[2, 2]; DitherGrassland = new Bitmap[2, 2]; DitherForest = new Bitmap[2, 2]; DitherHills = new Bitmap[2, 2]; DitherMountains = new Bitmap[2, 2]; DitherTundra = new Bitmap[2, 2]; DitherGlacier = new Bitmap[2, 2]; DitherSwamp = new Bitmap[2, 2]; DitherJungle = new Bitmap[2, 2]; Color replacementColor; for (int tileX = 0; tileX < 2; tileX++) { // For 4 directions (NE, SE, SW, NW) for (int tileY = 0; tileY < 2; tileY++) { DitherDesert[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherPlains[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherGrassland[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherForest[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherHills[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherMountains[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherTundra[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherGlacier[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherSwamp[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); DitherJungle[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba); for (int col = 0; col < 32; col++) { for (int row = 0; row < 16; row++) { // replacementColor = DitherBlank.GetPixel(tileX * 32 + col, tileY * 16 + row); replacementColor = DitherBlank[tileX, tileY].GetPixel(col, row); if (replacementColor == Color.FromArgb(0, 0, 0)) { DitherDesert[tileX, tileY].SetPixel(col, row, Desert[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherPlains[tileX, tileY].SetPixel(col, row, Plains[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherGrassland[tileX, tileY].SetPixel(col, row, Grassland[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherForest[tileX, tileY].SetPixel(col, row, ForestBase[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherHills[tileX, tileY].SetPixel(col, row, HillsBase[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherMountains[tileX, tileY].SetPixel(col, row, MtnsBase[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherTundra[tileX, tileY].SetPixel(col, row, Tundra[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherGlacier[tileX, tileY].SetPixel(col, row, Glacier[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherSwamp[tileX, tileY].SetPixel(col, row, Swamp[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); DitherJungle[tileX, tileY].SetPixel(col, row, Jungle[0].GetPixel((tileX * 32) + col, (tileY * 16) + row)); } else { DitherDesert[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherPlains[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherGrassland[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherForest[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherHills[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherMountains[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherTundra[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherGlacier[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherSwamp[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); DitherJungle[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0)); } } } } } // Rivers, Forest, Mountains, Hills for (int i = 0; i < 16; i++) { River[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 3 + (i / 8) + ((2 + (i / 8)) * 32), 64, 32)); River[i].ReplaceColors(transparentGray, Colors.Transparent); River[i].ReplaceColors(transparentPink, Colors.Transparent); Forest[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 5 + (i / 8) + ((4 + (i / 8)) * 32), 64, 32)); Forest[i].ReplaceColors(transparentGray, Colors.Transparent); Forest[i].ReplaceColors(transparentPink, Colors.Transparent); Mountains[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 7 + (i / 8) + ((6 + (i / 8)) * 32), 64, 32)); Mountains[i].ReplaceColors(transparentGray, Colors.Transparent); Mountains[i].ReplaceColors(transparentPink, Colors.Transparent); Hills[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 9 + (i / 8) + ((8 + (i / 8)) * 32), 64, 32)); Hills[i].ReplaceColors(transparentGray, Colors.Transparent); Hills[i].ReplaceColors(transparentPink, Colors.Transparent); } // River mouths for (int i = 0; i < 4; i++) { RiverMouth[i] = terrain2.Clone(new Rectangle(i + 1 + (i * 64), (11 * 1) + (10 * 32), 64, 32)); RiverMouth[i].ReplaceColors(transparentGray, Colors.Transparent); RiverMouth[i].ReplaceColors(transparentPink, Colors.Transparent); RiverMouth[i].ReplaceColors(transparentCyan, Colors.Transparent); } // Coast for (int i = 0; i < 8; i++) { Coast[i, 0] = terrain2.Clone(new Rectangle((2 * i) + 1 + (2 * i * 32), 429, 32, 16)); // N Coast[i, 0].ReplaceColors(transparentGray, Colors.Transparent); Coast[i, 1] = terrain2.Clone(new Rectangle((2 * i) + 1 + (2 * i * 32), 429 + (1 * 1) + (1 * 16), 32, 16)); // S Coast[i, 1].ReplaceColors(transparentGray, Colors.Transparent); Coast[i, 2] = terrain2.Clone(new Rectangle((2 * i) + 1 + (2 * i * 32), 429 + (2 * 1) + (2 * 16), 32, 16)); // W Coast[i, 2].ReplaceColors(transparentGray, Colors.Transparent); Coast[i, 3] = terrain2.Clone(new Rectangle((2 * (i + 1)) + (((2 * i) + 1) * 32), 429 + (2 * 1) + (2 * 16), 32, 16)); // E Coast[i, 3].ReplaceColors(transparentGray, Colors.Transparent); } // Road & railorad for (int i = 0; i < 9; i++) { Road[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), 364, 64, 32)); Road[i].ReplaceColors(transparentGray, Colors.Transparent); Road[i].ReplaceColors(transparentPink, Colors.Transparent); Railroad[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), 397, 64, 32)); Railroad[i].ReplaceColors(transparentGray, Colors.Transparent); Railroad[i].ReplaceColors(transparentPink, Colors.Transparent); } Irrigation = terrain1.Clone(new Rectangle(456, 100, 64, 32)); Irrigation.ReplaceColors(transparentGray, Colors.Transparent); Irrigation.ReplaceColors(transparentPink, Colors.Transparent); Farmland = terrain1.Clone(new Rectangle(456, 133, 64, 32)); Farmland.ReplaceColors(transparentGray, Colors.Transparent); Farmland.ReplaceColors(transparentPink, Colors.Transparent); Mining = terrain1.Clone(new Rectangle(456, 166, 64, 32)); Mining.ReplaceColors(transparentGray, Colors.Transparent); Mining.ReplaceColors(transparentPink, Colors.Transparent); Pollution = terrain1.Clone(new Rectangle(456, 199, 64, 32)); Pollution.ReplaceColors(transparentGray, Colors.Transparent); Pollution.ReplaceColors(transparentPink, Colors.Transparent); Shield = terrain1.Clone(new Rectangle(456, 232, 64, 32)); Shield.ReplaceColors(transparentGray, Colors.Transparent); Shield.ReplaceColors(transparentPink, Colors.Transparent); terrain1.Dispose(); terrain2.Dispose(); }
private void Start() { pollution = FindObjectOfType <Pollution>(); spotController = transform.parent.GetComponent <SpotController>(); }