public static Species GetSpecies(string name = "") { GradientColorKey[] colorKeys = new GradientColorKey[3]; float position = 0.0f; for (int i = 0; i < 3; i++) { colorKeys[i] = new GradientColorKey(Constants.GetRandomPastelColor(), position); position += 0.50f; } GradientAlphaKey[] alphaKeys = new GradientAlphaKey[2] { new GradientAlphaKey(1, 0), new GradientAlphaKey(1, 1) }; Gradient g = new Gradient(); g.alphaKeys = alphaKeys; g.colorKeys = colorKeys; Sprite[] sprites = SpriteLoader.GetRandomSetOfAlienSprites().ToArray(); if (name == "") { name = MarkovGenerator.GenerateMarkovWord(StringLoader.GetAllStrings("SpeciesButterfly"), 1)[0]; } return(new Species(name, sprites, g)); }
public void GenerateEntities() { data = GameDataManager.instance.masterGalaxyData; GameDataManager.instance.ClearAllEntities(); GameDataManager.instance.ClearAllSpecies(); string[] speciesNames = MarkovGenerator.GenerateMarkovWord(StringLoader.GetAllStrings("SpeciesButterfly"), numberOfSpecies); for (int i = 0; i < numberOfSpecies; i++) { GameDataManager.instance.AddNewSpecies(SpeciesGenerator.GetSpecies(speciesNames[i])); } for (int i = 0; i < data.sectors.Length; i++) { for (int j = 0; j < data.sectors[0].Length; j++) { if (data.sectors[i][j].Owner == null && data.sectors[i][j].SystemCount > 0) { unoccupiedSectors.Add(data.sectors[i][j]); } } } List <List <SectorData> > partitions = GenerateSectorPartitions(unoccupiedSectors); string[] entityNames = MarkovGenerator.GenerateMarkovWord(StringLoader.GetAllStrings("StarNames"), partitions.Count); for (int i = 0; i < partitions.Count; i++) { float averageSystem = 0; float maxSystem = 0; float minSystem = 10000; float sumOfSquares = 0; foreach (SectorData d in partitions[i]) { averageSystem += d.SystemCount; sumOfSquares += d.SystemCount * d.SystemCount; if (d.SystemCount > maxSystem) { maxSystem = d.SystemCount; } if (d.SystemCount < minSystem) { minSystem = d.SystemCount; } } float totalSystem = averageSystem; averageSystem = averageSystem / partitions[i].Count; float sumOfSquaresAverage = sumOfSquares / partitions[i].Count; float standardDeviation = Mathf.Sqrt(sumOfSquaresAverage - (averageSystem * averageSystem)); Debug.Log("Total System:" + totalSystem + " averageSystem:" + averageSystem + " minSystem:" + minSystem + " maxSystem:" + maxSystem + " stdDeviation:" + standardDeviation); GalaxyEntity g = GetEntity(partitions[i]); g.name = entityNames[i]; Debug.Log(g.leader.FullName + " " + g.Government.governmentName + " " + g.Government.governmentCatagory); GameDataManager.instance.AddNewEntity(g); } entityList.Display(GameDataManager.instance.Entitites); speciesList.Display(GameDataManager.instance.Species); WorldMap.instance.ShowTerritory(); }
public static Species[] GetMultipleSpecies(int number) { Species[] species = new Species[number]; string[] names = MarkovGenerator.GenerateMarkovWord(StringLoader.GetAllStrings("SpeciesButterfly"), 400); for (int i = 0; i < number; i++) { species[i] = GetSpecies(names[i]); } return(species); }
private void Awake() { player = PlayerManager.instance.activePlayer; player.Funds += 2000; title.ClearOptions(); title.options.Add(new Dropdown.OptionData("<i>None</i>")); foreach (string s in StringLoader.GetAllStrings("Titles")) { title.options.Add(new Dropdown.OptionData(s)); } title.value = 0; title.RefreshShownValue(); }
public GalaxyEntity GetEntity(List <SectorData> territory) { GalaxyEntity g = new GalaxyEntity(); g.flag = LayeredSpriteGenerator.GenerateLayeredSprites(new List <string>() { "FlagBack", "FlagMid", "FlagFront" }, entityPallette)[0]; g.color = g.flag.Colors[0]; string[] entityStrings = StringLoader.GetAllStrings("EntityStrings"); SectorData capital = territory[UnityEngine.Random.Range(0, territory.Count)]; territory.Remove(capital); g.capitalSector = capital; g.GainTerritory(territory); g.capitalSector.AddGalaxyFeature(new GalaxyFeature(g.FullName + " Capital", GalaxyFeatureType.EntityCapital, g.color)); return(g); }