public WorldState(Material _bridgeMat, Material _columnMat, Texture _floorTex, Texture _wallTex, float _sunSize, float _sunMoveSpeed, WorldColors _colors, MyGameRoom.RoomData _roomTypeData) { bridgeMat = _bridgeMat; columnMat = _columnMat; floorTex = _floorTex; wallTex = _wallTex; // roomPrefab = _roomPrefab; sunSize = _sunSize; sunMoveSpeed = _sunMoveSpeed; colors = _colors; roomTypeData = _roomTypeData; }
void SetWorldState() { Material newBridgeMat = bridgeMaterials[UnityEngine.Random.Range(0, bridgeMaterials.Length)]; Material newColumnMat = columnMaterials[UnityEngine.Random.Range(0, columnMaterials.Length)]; float atmoIntensity = 0; int atmoType = UnityEngine.Random.Range(0, 9); //no atmo, low atmo, super atmo if (atmoType <= 4) { atmoIntensity = UnityEngine.Random.Range(0.1f, 0.4f); } else if (atmoType <= 7) { atmoIntensity = UnityEngine.Random.Range(2.5f, 4f); } skybox.SetFloat("_AtmosphereThickness", atmoIntensity); float sunSpeed = UnityEngine.Random.Range(sunSpeedMin, sunSpeedMax); float sunSize = UnityEngine.Random.Range(sunSizeMin, sunSizeMax); skybox.SetFloat("_SunSize", sunSize); sun.intensity = sunSize * 60; WorldColors color = worldColors[UnityEngine.Random.Range(0, worldColors.Length)]; skybox.SetColor("_SkyTint", color.skyColor); skybox.SetColor("_GroundColor", color.groundColor); RenderSettings.fogColor = color.skyColor; if (UnityEngine.Random.value < 0.25) { oceanMat.enabled = true; oceanMat.material.color = color.groundColor; } else { oceanMat.enabled = false; } System.Array values = Enum.GetValues(typeof(MyGameRoom.RoomFloorType)); MyGameRoom.RoomFloorType _floorType = (MyGameRoom.RoomFloorType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); values = Enum.GetValues(typeof(MyGameRoom.RoomCeilingType)); MyGameRoom.RoomCeilingType _ceilingType = (MyGameRoom.RoomCeilingType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); state = new WorldState(newBridgeMat, newColumnMat, floorTexs[UnityEngine.Random.Range(0, floorTexs.Length)], wallTexs[UnityEngine.Random.Range(0, wallTexs.Length)], sunSize, sunSpeed, color, new MyGameRoom.RoomData(_floorType, _ceilingType)); }