public string GetDescription() { string description = ""; description += "Infection Report: \n"; description += "- Player who applied infection:"; if (PlayerWhoAppliesInfection != -1) { description += "Player_" + PlayerWhoAppliesInfection.ToString() + "\n"; } else { description += "\n"; } description += "- Initial City: " + InitialCity.ToString() + "\n"; description += "- Infection Type: " + InfectionType + "\n"; description += "- Initial Number of Cubes: " + InitialNumberOfCubes + "\n"; description += "- Number of Infected Cities: " + InfectedCities.Count + "\n"; description += "- Infected Cities: \n"; foreach (var city in InfectedCities) { description += "- - " + city.ToString() + "\n"; } description += "- Number of Outbreaks: " + CitiesThatHaveCausedOutbreaks.Count + "\n"; description += "- Cities that caused outbreaks:\n"; foreach (var city in CitiesThatHaveCausedOutbreaks) { description += "- - " + city.ToString() + "\n"; } description += "- Infection Failure Reason: "; description += FailureReason.ToString() + "\n"; description += "\n"; return(description); }
void Update() { if (parent.GetComponent <Updater>().EventShown) { return; } Vector2 relPos = Input.mousePosition - Camera.main.WorldToScreenPoint(corners[1]); Vector2Int map = new Vector2Int((int)(relPos.x / 60), (int)(relPos.y / 60)); Vector2 mapPos = map; mapPos.x *= 60; mapPos.x += 30; mapPos.y *= 60; mapPos.y -= 30; if (map.x < 0 || map.x > 9 || map.y < -9 || map.y > 0) { selector.gameObject.SetActive(false); return; } else { selector.gameObject.SetActive(true); } if (buildings[map.x, -map.y] != null) { return; } InitialCity city = parent.GetComponent <InitialCity>(); Updater update = parent.GetComponent <Updater>(); if (Input.GetMouseButtonUp(0)) { if (!parent.GetComponent <Updater>().currentBuild.Build()) { return; } buildings[map.x, -map.y] = Instantiate(building, transform.GetChild(0)); buildings[map.x, -map.y].GetComponent <RectTransform>().anchoredPosition = mapPos; Color selectorColor = transform.GetChild(1).GetComponent <Image>().color; selectorColor.a = 1; buildings[map.x, -map.y].GetComponent <Image>().color = selectorColor; parent.GetComponent <InitialCity>().buildingList[(parent.GetComponent <Updater>().currentBuild).GetType()] += 1; return; } else { selector.GetComponent <RectTransform>().anchoredPosition = mapPos; } }
public override int GetHashCode() { int hash = 17; hash = (hash * 31) + (HappenedDuringGameSetup == true ? 1 : 0); hash = (hash * 31) + PlayerWhoAppliesInfection.GetHashCode(); hash = (hash * 31) + InitialCity.GetHashCode(); hash = (hash * 31) + InfectionType; hash = (hash * 31) + InitialNumberOfCubes; hash = (hash * 31) + InfectedCities.Custom_HashCode(); hash = (hash * 31) + InfectionsPrevented_ByMedic.Custom_HashCode(); hash = (hash * 31) + CitiesThatHaveCausedOutbreaks.Custom_HashCode(); hash = (hash * 31) + NumberOfInfectionCubesUsed; hash = (hash * 31) + FailureReason.GetHashCode(); return(hash); }