public Land(LandPrefix pre, LandSuffix suf) { int rnd1, rnd2; rnd1 = Random.Range(0, 3); rnd2 = Random.Range(0, 3); landName = "Land of " + pre.landNames[rnd1] + " and " + suf.landNames[rnd2]; }
private int addLandSuffix(int i, string[] landName, PlayerClass compatibleClass, PlayerAspect compatibleAspect, bool based, bool dungeons) { i++; LandSuffix tempLand = new LandSuffix(landName, i, based, dungeons); tempLand.compatibleAspect = compatibleAspect; tempLand.compatibleClass = compatibleClass; landSuffixes.Add(landName[0], tempLand); return(i); }
public void generateLand() { string[] tempArr = new string[6]; LandPrefix tempPrefix = new LandPrefix(tempArr, 0, false, false); List <LandPrefix> preList = new List <LandPrefix>(); LandSuffix tempSuffix = new LandSuffix(tempArr, 0, false, false); List <LandSuffix> sufList = new List <LandSuffix>(); bool dungeons = false; foreach (KeyValuePair <string, LandPrefix> entry in data.landPrefixes) { if (entry.Value.aspectBased) { if (entry.Value.compatibleAspect == characterAspect) { if (characterAspect != data.aspects["Space"] || entry.Value.dictatesDungeons) { // SUCCESS preList.Add(entry.Value); } } } else if (entry.Value.compatibleClass == characterClass) { if (characterAspect != data.aspects["Space"] || entry.Value.dictatesDungeons) { // SUCCESS preList.Add(entry.Value); } } } int rnd = Random.Range(0, preList.Count); tempPrefix = preList[rnd]; if (tempPrefix.dictatesDungeons) { dungeons = true; } if (characterAspect != data.aspects["Space"]) { foreach (KeyValuePair <string, LandSuffix> entry in data.landSuffixes) { if (entry.Value.aspectBased) { if (entry.Value.compatibleAspect == characterAspect) { if (entry.Value.dictatesDungeons && dungeons != true) { // SUCCESS sufList.Add(entry.Value); } else if (entry.Value.dictatesDungeons != true && dungeons) { // SUCCESS sufList.Add(entry.Value); } } } else if (entry.Value.compatibleClass == characterClass) { if (entry.Value.dictatesDungeons && dungeons != true) { // SUCCESS sufList.Add(entry.Value); } else if (entry.Value.dictatesDungeons != true && dungeons) { // SUCCESS sufList.Add(entry.Value); } } } } else { sufList.Add(data.landSuffixes["Frogs"]); } rnd = Random.Range(0, sufList.Count); tempSuffix = sufList[rnd]; if (tempSuffix.dictatesDungeons) { dungeons = true; } if (dungeons == true) { characterLand = new Land(tempPrefix, tempSuffix); } else { Debug.Log("Dungeons not enabled."); } }