public override void Awake() { base.Awake(); if (prespawned) // we do not spawn again a Village which is already on the map before first frame happens { return; } locationType = MapScript.LocationType.Wioska; size = RandomVillageWealth(); population = (3 + (int)size) * Random.Range(45, 65); gameObject.layer = 8; locationName = GetNewRandomName(); PlaceHouses(); PlaceSpecialBuilding(); PlaceFields(); gameObject.isStatic = true; prespawned = true; }
/// <summary> /// Assures that average size/wealth of a Village will be 'Przeciętna' (average) /// </summary> /// <returns></returns> private MapScript.VillageSize RandomVillageWealth() { MapScript.VillageSize desiredSize = (MapScript.VillageSize)Random.Range(0, 3); if (desiredSize == MapScript.VillageSize.Przeciętna) { return(desiredSize); } if (Random.value > 0.5f) { desiredSize = MapScript.VillageSize.Przeciętna; } return(desiredSize); }