public void Initialize(Tribe tribe) { if (debug) // DEBUG { InitializeDebug(tribe); return; } areaSize = world.masterTerrain.GetSize(); for (int count = 0; count < walls.Length; count++) { walls[count] = GameObject.Instantiate(RAKUtilities.getWorldPrefab("Wall"), null); walls[count].transform.GetChild(0).localScale = new Vector3(areaSize.x, 256, 1); } walls[0].transform.position = new Vector3(areaSize.x / 2, 128, 1); walls[1].transform.rotation = Quaternion.Euler(new Vector3(0, 90, 0)); walls[1].transform.position = new Vector3(0, 0, areaSize.z / 2); walls[2].transform.position = new Vector3(areaSize.x / 2, 0, areaSize.z); walls[3].transform.rotation = Quaternion.Euler(new Vector3(0, 90, 0)); walls[3].transform.position = new Vector3(areaSize.x, 0, areaSize.z / 2); if (thingContainer == null) { thingContainer = new GameObject("ThingContainer"); } if (creatureContainer == null) { creatureContainer = new GameObject("CreatureContainer"); } if (disabledContainer == null) { disabledContainer = new GameObject("DisabledContainer"); } allThings = new List <Thing>(); // Scan the TerrainObjects placed in map for Things // foreach (RAKTerrain terrain in world.masterTerrain.getTerrain()) { foreach (RAKTerrainObject terrainObject in terrain.nonTerrainObjects) { Thing thing = terrainObject.gameObject.GetComponent <Thing>(); if (thing != null) { allThings.Add(thing); thing.initialize(thing.name); } } } int populationToCreate = tribe.GetPopulation(); int MAXPOP = 100; if (populationToCreate > MAXPOP) { populationToCreate = MAXPOP; } Debug.LogWarning("Generating a population of - " + populationToCreate); for (int count = 0; count < populationToCreate; count++) { addCreatureToWorld("Gnat"); } }
public static AudioClip GetCreaturePartAudioClip(BASE_SPECIES species, CreaturePart part) { if (species == BASE_SPECIES.Gnat) { if (part == CreaturePart.BRAKE) { return(RAKUtilities.getAudioClip("GnatBrake")); } } return(null); }
public static RAKTerrainObjectSaveData createSaveData(RAKTerrainObject terrainObject) { RAKTerrainObjectSaveData saveData = new RAKTerrainObjectSaveData(); saveData.prefabObjectIndex = RAKUtilities.GetNonTerrainObjectIndex(terrainObject.prefabObjectName); Vector3 position = terrainObject.transform.position; saveData.position = new RAKTerrainMaster.RAKTerrainSavedData.RAKVector3(position); Quaternion rotation = terrainObject.transform.rotation; saveData.rotationEulers = new RAKTerrainMaster.RAKTerrainSavedData.RAKVector3(rotation); return(saveData); }
private void Awake() { ISDEBUGSCENE = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.ToLower().Contains("debug"); if (ISDEBUGSCENE && !_initialized) { InitializeDebugWorld(); return; } world = this; FollowCamera = this.followCamera; WORLD_DATAPATH = Application.persistentDataPath + "/Worlds/"; if (!Directory.Exists(WORLD_DATAPATH)) { Directory.CreateDirectory(WORLD_DATAPATH); } worldType = WorldType.CLASSM; worldName = "AlphaWorld"; tribes = new Dictionary <HexCell, Tribe>(); civilizations = new List <Civilization>(); civilizations.Add(new Civilization(BASE_SPECIES.Gnat, "DaGnats", true, 5, 15)); HexMetrics.Initialize(worldType); hexGrid = HexGrid.generate(this); mapCam.grid = hexGrid; //masterTerrain = GetComponent<RAKTerrainMaster>(); if (editing) { editor = Instantiate(RAKUtilities.getWorldPrefab("HexMapEditor")).GetComponent <HexMapEditor>(); } for (int count = 0; count < NUMBEROFSTARTINGCIVS; count++) { Tribe tribe = new Tribe(1200, BASE_SPECIES.Gnat); HexCell cell = tribe.FindHome(this, true); //civilizations[0].AddTribe(tribe); addTribe(tribe, cell); } hexGrid.RefreshAllChunks(); mainMenu = new MenuController(creatureBrowserPrefab, worldBrowserPrefab, debugMenuPrefab); if (AutoLoadArea) { HexCell autoLoadCell = hexGrid.GetCell(new Vector3(0, 0, 0)); LoadArea(autoLoadCell); mainMenu.Initialize(RootMenu.CreatureBrowser); } else { mainMenu.Initialize(RootMenu.WorldBrowser); } _initialized = true; }
private void setWeather(WeatherType weather) { this.currentWeather = weather; if (currentWeather == WeatherType.Clear) { skyboxMat = RAKUtilities.getMaterial(RAKUtilities.MATERIAL_SKYBOX_SUNSET); skyboxMat.color = new Color32(164, 164, 164, 196); skyboxExposure = 1f; windAudio.volume = 0; windZone.windMain = 0; audioSource.volume = 0; } else if (currentWeather == WeatherType.Overcast) { skyboxMat = RAKUtilities.getMaterial(RAKUtilities.MATERIAL_SKYBOX_SUNSET); skyboxMat.color = new Color32(184, 255, 193, 202); skyboxExposure = 1.28f; windAudio.volume = .2f; audioSource.volume = .4f; windZone.mode = WindZoneMode.Directional; windZone.windMain = 1; } else if (currentWeather == WeatherType.DownPour) { skyboxMat = RAKUtilities.getMaterial(RAKUtilities.MATERIAL_SKYBOX_SUNSET); skyboxMat.color = new Color32(164, 164, 164, 196); skyboxExposure = 1; windAudio.volume = .5f; audioSource.volume = .8f; windZone.mode = WindZoneMode.Spherical; windZone.windMain = 2; } if (currentWeather != WeatherType.Clear) { generateClouds(masterTerrain.transform, masterTerrain.getTerrain(), currentWeather); audioSource.Play(); } else { clouds = new RAKCloud[0]; } windAudio.Play(); skyboxMat.SetFloat("_Exposure", skyboxExposure); RenderSettings.skybox = skyboxMat; DynamicGI.UpdateEnvironment(); }
public static HexGrid generate(World world) { HexGrid grid = Instantiate(RAKUtilities.getWorldPrefab("HexGrid").GetComponent <HexGrid>()); if (world.worldType == World.WorldType.CLASSM) { grid.cellPrefab = RAKUtilities.getWorldPrefab("Hex Cell").GetComponent <HexCell>(); grid.cellLabelPrefab = RAKUtilities.getWorldPrefab("Hex Cell Label").GetComponent <Text>(); grid.chunkPrefab = RAKUtilities.getWorldPrefab("Hex Grid Chunk").GetComponent <HexGridChunk>(); grid.cellCountX = grid.chunkCountX * HexMetrics.chunkSizeX; grid.cellCountZ = grid.chunkCountZ * HexMetrics.chunkSizeZ; } grid.SetWorld(world); grid.CreateChunks(world.worldType); grid.CreateCells(); return(grid); }
public void start(Transform master, RAKTerrainMaster masterTerrain, GameObject sun) { this.sun = sun; this.masterTerrain = masterTerrain; windZone = master.gameObject.GetComponent <WindZone>(); audioClips = new RAKAudioClip[2]; audioClips[0] = new RAKAudioClip(RAKUtilities.getAudioClip(RAKUtilities.AUDIO_CLIP_RAIN_LIGHT)); audioClips[1] = new RAKAudioClip(RAKUtilities.getAudioClip(RAKUtilities.AUDIO_CLIP_WIND_MEDIUM)); rainPrefab = RAKUtilities.getPrefab("RainPrefab"); audioSource = master.gameObject.AddComponent <AudioSource>(); audioSource.clip = audioClips[0].audioClip; audioSource.loop = true; windAudio = master.gameObject.AddComponent <AudioSource>(); windAudio.clip = audioClips[1].audioClip; windAudio.loop = true; setWeather(WeatherType.Clear); initialized = true; }
public GameObject addThingToWorld(string nameOfPrefab, Vector3 position, bool generatePos) { GameObject thingObject = RAKUtilities.getThingPrefab(nameOfPrefab); GameObject newThing = UnityEngine.Object.Instantiate(thingObject); newThing.transform.SetParent(thingContainer.transform); newThing.GetComponent <Thing>().initialize("fruit"); if (!generatePos) { newThing.transform.position = position; } else { newThing.transform.position = GetRandomPositionOnNavMesh(); } AddThingToAllThingsSync(newThing.GetComponent <Thing>()); return(newThing); }
public static void SetPropertiesForParticleSystemByCreature(ParticleSystem ps, Creature creature) { ps.Stop(); if (creature.getSpecies().getBaseSpecies() == BASE_SPECIES.Gnat) { ParticleSystem.MainModule main = ps.main; main.duration = .3f; main.loop = false; main.prewarm = false; main.startDelay = 0; main.startLifetime = .3f; main.startSpeed = new ParticleSystem.MinMaxCurve(10, 20); main.startSize = .1f; main.startColor = Color.yellow; ParticleSystem.EmissionModule emission = ps.emission; emission.rateOverTime = 750; emission.rateOverDistance = 0; ParticleSystem.ShapeModule shape = ps.shape; shape.shapeType = ParticleSystemShapeType.Donut; shape.radius = 1; shape.donutRadius = .2f; shape.radiusThickness = 1; shape.arc = 360; shape.arcMode = ParticleSystemShapeMultiModeValue.BurstSpread; shape.arcSpread = 0; shape.rotation = new Vector3(90, 0, 0); shape.scale = new Vector3(.4f, .4f, 1); shape.randomDirectionAmount = 1; ParticleSystemRenderer renderer = ps.GetComponent <ParticleSystemRenderer>(); renderer.renderMode = ParticleSystemRenderMode.Stretch; renderer.normalDirection = 1; renderer.material = RAKUtilities.getMaterial("GnatSpark"); renderer.sortMode = ParticleSystemSortMode.YoungestInFront; renderer.minParticleSize = .01f; renderer.maxParticleSize = .05f; renderer.lengthScale = .2f; } }
private void addCreatureToWorld(string nameOfPrefab, Vector3 position, bool generatePosition) { GameObject thingObject = RAKUtilities.getCreaturePrefab(nameOfPrefab); GameObject newThing = Object.Instantiate(thingObject); newThing.transform.SetParent(creatureContainer.transform); newThing.GetComponent <Creature>().Initialize(nameOfPrefab, this, null); newThing.transform.localPosition = Vector3.zero; newThing.transform.rotation = Quaternion.identity; if (!generatePosition) { newThing.transform.position = position; } else { float x = Random.Range(0, areaSize.x); float z = Random.Range(0, areaSize.z); Vector2 targetSpawn = new Vector2(x, z); float y = world.masterTerrain.GetTerrainHeightAt(targetSpawn, GetClosestTerrainToPoint(targetSpawn)); newThing.transform.position = new Vector3(x, y, z); } AddThingToAllThingsSync(newThing.GetComponent <Thing>()); }
// Create new unity objects from data from disk // private void generateNonTerrainDetailsFromDisk(RAKTerrain terrain) { // Get all objects from save // RAKTerrainObjectSaveData[] objects = terrain.savedData.nonTerrainObjectsSaveData; List <RAKTerrainObject> loadedTerrainObjects = new List <RAKTerrainObject>(); for (int count = 0; count < objects.Length; count++) { // Retrieve the prefab and Instantiate // Debug.LogWarning(objects[count].prefabObjectIndex); if (objects[count].prefabObjectIndex == -1) { Debug.LogWarning("Object # " + count + " returned -1"); continue; } string prefabName = RAKUtilities.nonTerrainObjects[objects[count].prefabObjectIndex]; RAKTerrainObject terrainObject = RAKUtilities.getTerrainObjectPrefab(prefabName).GetComponent <RAKTerrainObject>(); GameObject prefab = (GameObject)Instantiate(terrainObject.gameObject, objects[count].position.getVector3(), Quaternion.identity);//, 2); prefab.transform.eulerAngles = objects[count].rotationEulers.getVector3(); prefab.transform.SetParent(terrain.transform); loadedTerrainObjects.Add(terrainObject); } terrain.nonTerrainObjects = loadedTerrainObjects.ToArray(); }
// Generate details for a RAKTerrain object // private void generateNonTerrainDetailPrefabs(Terrain terrain) { RAKTerrain rakTerrain = terrain.GetComponent <RAKTerrain>(); TerrainData data = terrain.terrainData; RAKBiome biome = rakTerrain.getBiome(); int sum = 0; Array.ForEach(biome.objectCounts, delegate(int i) { sum += i; }); int totalNumberOfObjects = sum; GameObject[] details = new GameObject[totalNumberOfObjects]; int currentDetailCount = 0; for (int currentObjectCount = 0; currentObjectCount < biome.objectCounts.Length; currentObjectCount++) { GameObject prefab = null; try { prefab = RAKUtilities.getTerrainObjectPrefab(biome.prefabNames[currentObjectCount]); } catch (Exception e) { Debug.LogWarning("Unable to get prefab - " + biome.prefabNames[currentObjectCount]); continue; } RAKTerrainObject terrainObject = prefab.GetComponent <RAKTerrainObject>(); terrainObject.UpdatePropertiesBasedOnName(prefab.name); int maxTries = terrainObject.numberOfTimesToSearchForLocation; float maxSteepness = terrainObject.maxSteepness; float minDistFromEdge = terrainObject.minDistFromEdge; float minimiumDistanceBetweenObjects = terrainObject.minimiumDistanceBetweenObjects; float heightOffset = terrainObject.heightOffset; MeshFilter meshFilter = terrainObject.GetComponent <MeshFilter>(); float detailHeight, detailWidthX, detailWidthZ; if (meshFilter == null) { detailHeight = 1; detailWidthX = 1; detailWidthZ = 1; } else { detailHeight = prefab.GetComponent <MeshFilter>().sharedMesh.bounds.size.y *prefab.transform.localScale.y; detailWidthX = prefab.GetComponent <MeshFilter>().sharedMesh.bounds.size.x *prefab.transform.localScale.x; detailWidthZ = prefab.GetComponent <MeshFilter>().sharedMesh.bounds.size.z *prefab.transform.localScale.z; } // Sometimes we need to force a width if the bottom of the object is skinny (trees) // if (terrainObject.sizeOverride != Vector3.zero) { detailWidthX = terrainObject.sizeOverride.x; detailWidthZ = terrainObject.sizeOverride.z; detailHeight = terrainObject.sizeOverride.y; } float widthXNorm = (detailWidthX / data.heightmapWidth) * 100; float widthZNorm = (detailWidthZ / data.heightmapHeight) * 100; string debugString = ""; for (int count = 0; count < biome.objectCounts[currentObjectCount]; count++) { bool locationValid = false; float x = 0; float z = 0; float y = 0; int tries = 0; while (!locationValid) { locationValid = true; tries++; x = UnityEngine.Random.Range(0, width); z = UnityEngine.Random.Range(0, height); float zNormed = (float)z / (float)data.heightmapHeight; float xNormed = (float)x / (float)data.heightmapWidth; y = data.GetInterpolatedHeight(xNormed, zNormed) - detailHeight - heightOffset; if (x < detailWidthX + minDistFromEdge || x > width - detailWidthX - minDistFromEdge) { locationValid = false; debugString = "Too close to edgeX - " + x; continue; } if (z < detailWidthZ + minDistFromEdge || z > height - detailWidthZ - minDistFromEdge) { locationValid = false; debugString = "Too close to edgeZ - " + z; continue; } locationValid = true; for (int otherObjectsCount = 0; otherObjectsCount < details.Length; otherObjectsCount++) { if (details[otherObjectsCount] != null) { if (Vector2.Distance(new Vector2(terrain.transform.position.x + x, terrain.transform.position.z + z), new Vector2(details[otherObjectsCount].transform.position.x, details[otherObjectsCount].transform.position.z)) < details[otherObjectsCount].GetComponent <RAKTerrainObject>().minimiumDistanceBetweenObjects) { locationValid = false; debugString = "Too close to other object - " + (Vector2.Distance(new Vector2(terrain.transform.position.x + x, terrain.transform.position.z + z), new Vector2(details[otherObjectsCount].transform.position.x, details[otherObjectsCount].transform.position.z)) + " - " + (details[otherObjectsCount].GetComponent <RAKTerrainObject>().minimiumDistanceBetweenObjects)); break; } } } if (locationValid) { for (int countX = (int)-widthXNorm; countX < widthXNorm; countX++) { for (int countZ = (int)-widthZNorm; countZ < widthZNorm; countZ++) { float steepness = data.GetSteepness((x + countX) / data.alphamapWidth, (z + countZ) / data.alphamapHeight); if (steepness > maxSteepness) { locationValid = false; debugString = "Too steep - " + steepness + " - " + maxSteepness; } } } } if (tries >= maxTries) { Debug.LogWarning(debugString + " - " + terrainObject.name); break; } } if (locationValid) { details[currentDetailCount] = (GameObject)Instantiate(prefab, new Vector3 (x + terrain.transform.position.x, y + detailHeight, z + terrain.transform.position.z), Quaternion.identity);//, 3); details[currentDetailCount].gameObject.name = prefab.name; details[currentDetailCount].transform.SetParent(terrain.transform); Debug.LogWarning("Instantiated - " + details[currentDetailCount].name); //details[currentDetailCount].GetComponent<RAKTerrainObject>().setPrefabObjectName(prefab.name); //details[currentDetailCount].transform.position = new Vector3(x + terrain.transform.position.x, y + detailHeight, z + terrain.transform.position.z); if (!terrainObject.freeRotate) { details[currentDetailCount].transform.rotation = Quaternion.Euler(new Vector3(0, UnityEngine.Random.Range(0, 360), 0)); } else { details[currentDetailCount].transform.rotation = Quaternion.Euler(new Vector3(UnityEngine.Random.Range(0, 360), UnityEngine.Random.Range(0, 360), UnityEngine.Random.Range(0, 360))); } } currentDetailCount++; } } if (details != null) { List <RAKTerrainObject> nonTerrainObjects = new List <RAKTerrainObject>(); for (int count = 0; count < details.Length; count++) { if (details[count] != null) { RAKTerrainObject terrainObject = details[count].GetComponent <RAKTerrainObject>(); nonTerrainObjects.Add(terrainObject); } } rakTerrain.nonTerrainObjects = nonTerrainObjects.ToArray(); } }
public GameObject addCloudParticle(CloudType cloudType, GameObject parent) { GameObject cloudSection; if (cloudType == CloudType.DENSE_NORMAL) { cloudSection = RAKUtilities.getPrefab("CloudSectionAngry"); } else { cloudSection = null; } cloudSection = (GameObject)Instantiate(cloudSection, Vector3.zero, Quaternion.identity);//, 1); cloudSection.transform.SetParent(parent.transform); cloudSection.transform.localPosition = Vector3.zero; return(cloudSection); /*ParticleSystem po = parent.AddComponent<ParticleSystem>(); * ParticleSystem.MainModule mainModule = po.main; * * ParticleSystem.ShapeModule shapeModule = po.shape; * ParticleSystem.MinMaxCurve emissionCurve = po.emission.rateOverTime; * ParticleSystem.LimitVelocityOverLifetimeModule velOverTimeModule = po.limitVelocityOverLifetime; * ParticleSystem.ColorOverLifetimeModule colorModule = po.colorOverLifetime; * ParticleSystem.ColorBySpeedModule colorBySpeed = po.colorBySpeed; * ParticleSystem.RotationOverLifetimeModule rotationModule = po.rotationOverLifetime; * ParticleSystem.NoiseModule noiseModule = po.noise; * po.Stop(); * if (cloudType == CloudType.DENSE_NORMAL) * { * ParticleSystem.MinMaxCurve startSize = new ParticleSystem.MinMaxCurve(25); * mainModule.startSize = startSize; * mainModule.startRotationX = 0; * mainModule.startRotationY = 360; * mainModule.maxParticles = 5000; * mainModule.duration = 10; * mainModule.loop = true; * mainModule.prewarm = true; * mainModule.startLifetime = 10; * mainModule.gravityModifier = .4f; * mainModule.simulationSpace = ParticleSystemSimulationSpace.World; * mainModule.simulationSpeed = .2f; * mainModule.startSpeed = 0; * mainModule.scalingMode = ParticleSystemScalingMode.Shape; * mainModule.emitterVelocityMode = ParticleSystemEmitterVelocityMode.Transform; * ParticleSystem.MinMaxGradient startGradient = new ParticleSystem.MinMaxGradient(new Color(79, 79, 79, 255), new Color(161, 161, 161, 255)); * mainModule.startColor = startGradient; * * shapeModule.shapeType = ParticleSystemShapeType.Box; * shapeModule.scale = new Vector3(10, 0, 10); * shapeModule.randomDirectionAmount = 0; * shapeModule.randomPositionAmount = 0; * * emissionCurve.constant = 500; * * velOverTimeModule.limit = 50; * velOverTimeModule.dampen = .1f; * velOverTimeModule.enabled = true; * * Gradient colorOverLifeGradient = new Gradient(); * GradientColorKey[] colorOverLifeColorKeys = new GradientColorKey[2]; * colorOverLifeColorKeys[0] = new GradientColorKey(new Color(128, 128, 128), 0); * colorOverLifeColorKeys[1] = new GradientColorKey(new Color(45, 95, 118), 100); * colorOverLifeGradient.SetKeys(colorOverLifeColorKeys, new GradientAlphaKey[] { new GradientAlphaKey(255, 0) }); * colorModule.color = colorOverLifeGradient; * colorModule.enabled = true; * * Gradient speedGradient = new Gradient(); * GradientColorKey[] speedColorKeys = new GradientColorKey[3]; * speedColorKeys[0] = new GradientColorKey(new Color(45, 95, 118), 0); * speedColorKeys[1] = new GradientColorKey(new Color(8, 46, 63), 40); * speedColorKeys[2] = new GradientColorKey(new Color(0, 0, 0), 100); * speedGradient.SetKeys(speedColorKeys, new GradientAlphaKey[] { new GradientAlphaKey(255, 0) }); * colorBySpeed.color = speedGradient; * colorBySpeed.range = new Vector2(0, 50); * colorBySpeed.enabled = true; * * rotationModule.x = 75; * rotationModule.y = 75; * rotationModule.z = 75; * rotationModule.enabled = true; * * noiseModule.strength = 10; * noiseModule.frequency = .05f; * noiseModule.scrollSpeed = 1; * noiseModule.damping = true; * noiseModule.octaveCount = 4; * noiseModule.octaveMultiplier = .5f; * noiseModule.octaveScale = 2; * noiseModule.enabled = true; * } * else if (cloudType == CloudType.LIGHT_NORMAL) * { * ParticleSystem.MinMaxCurve startSize = new ParticleSystem.MinMaxCurve(15, 25); * mainModule.startSize = startSize; * shapeModule.scale = new Vector3(15, 0, 15); * emissionCurve.constant = 150; * mainModule.maxParticles = 450; * shapeModule.randomDirectionAmount = 1; * shapeModule.randomPositionAmount = 1; * } * po.Play(); * return po;*/ }
public void GenerateDetails() { if (IsUnderwater) { return; } // POPULATION BUILDINGS // if (currentOccupants != null) { GameObject buildingPrefab = null; int buildingsToGenerate = 0; // TENTS // if (currentOccupants.GetPopulation() > 10 && currentOccupants.GetPopulation() < 100) { buildingsToGenerate = currentOccupants.GetPopulation() / 15; if (buildingsToGenerate == 0) { buildingsToGenerate = 1; } buildingPrefab = RAKUtilities.getWorldPrefab(Civilization.PREFABTENT); } // VILLAGE // else if (currentOccupants.GetPopulation() >= 100) { // BUILD ROADS // if (currentOccupants.GetPopulation() >= Civilization.STARTBUILDINGROADSATPOPULATION) { for (int count = 0; count < neighbors.Length; count++) { if (neighbors[count] != null && neighbors[count].CurrentOccupants != null && neighbors[count].CurrentOccupants.GetPopulation() >= 100) { roads[count] = true; } } } // BUILD HOUSES // if (currentOccupants.GetPopulation() <= 1000) { buildingsToGenerate = currentOccupants.GetPopulation() / 150; if (buildingsToGenerate == 0) { buildingsToGenerate = 1; } buildingPrefab = RAKUtilities.getWorldPrefab(Civilization.PREFABTOWNHOUSE1); } // Big Village // else { buildingsToGenerate = 1; buildingPrefab = RAKUtilities.getWorldPrefab(Civilization.PREFABTOWNWINDMILL); } // INSTANTIATE BUILDINGS // if (buildingPrefab != null && buildingsToGenerate > 0) { GameObject building = null; if (buildingsToGenerate > 1) { for (int count = 0; count < buildingsToGenerate; count++) { building = Instantiate(buildingPrefab); building.transform.SetParent(transform, false); building.transform.RotateAround(transform.position, Vector3.up, 60 * count); building.transform.rotation = Quaternion.Euler(0, Random.Range(0, 360), 0); } } // Center if only building // else { building = Instantiate(buildingPrefab); building.transform.SetParent(transform, false); building.transform.position = transform.position; building.transform.rotation = Quaternion.Euler(0, Random.Range(0, 360), 0); } } } } }
public static void Initialize(rak.world.World.WorldType worldType) { noiseSource = RAKUtilities.getTexture("Noise"); colors = getColorPalette(worldType); }