public void Prepare(Chunk c) { myChunk = c; env = GameMaster.realMaster.environmentMaster; lifepowerSupport = env.lifepowerSupport; env.environmentChangingEvent += EnvironmentSetting; prepared = true; treeTypes = new List <PlantType>() { PlantType.OakTree }; lifepower = 100f; lifepowerSurplus = 2f; gm = GameMaster.realMaster; }
// EnvironmentMaster.environmentalConditions //GameMaster.lifegrowCoefficient public static void ResetStaticData() { current = null; if (cityMarker != null) { indicatorPrepared = true; markerEnabled = cityMarker.transform.parent.gameObject.activeSelf; } else { indicatorPrepared = false; markerEnabled = false; } envMaster = GameMaster.realMaster.environmentMaster; }
private void PrepareIndicator() { var g = Instantiate(Resources.Load <GameObject>("UIPrefs/stabilityIndicator"), UIController.current.mainCanvas); var t = g.transform; //t.parent = UIController.current.mainCanvas; //(t as RectTransform).position = Vector2.down * 60f; INDICATOR_EDGE_POSITION = (t as RectTransform).rect.width / 2f * 0.99f; t.SetAsFirstSibling(); cityMarker = t.GetChild(2).GetComponent <RectTransform>(); indicatorPrepared = true; cityMarker.parent.gameObject.SetActive(false); markerEnabled = false; envMaster = GameMaster.realMaster.environmentMaster; }
private void Awake() { // Singleton if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } environmentAnimator = GetComponent <Animator>(); UpdateEnvironment(); }
public void LinkEnvironmentMaster(EnvironmentMaster em) { envMaster = em; }
public void Load(System.IO.FileStream fs, Chunk c) { env = GameMaster.realMaster.environmentMaster; lifepowerSupport = env.lifepowerSupport; myChunk = c; // var data = new byte[20]; fs.Read(data, 0, data.Length); lifepower = System.BitConverter.ToSingle(data, 0); grasslandCreateTimer = System.BitConverter.ToSingle(data, 4); grasslandsUpdateTimer = System.BitConverter.ToSingle(data, 8); lastUpdateIndex = System.BitConverter.ToInt32(data, 12); // int count = System.BitConverter.ToInt32(data, 16), i; grasslands = null; if (count != 0) { grasslands = new List <Grassland>(); Grassland g; for (i = 0; i < count; i++) { g = Grassland.Load(fs, this, myChunk); if (g != null) { grasslands.Add(g); } } if (grasslands.Count == 0) { grasslands = null; } } // count = fs.ReadByte(); flowerTypes = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { flowerTypes.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); bushTypes = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { bushTypes.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); treeTypes = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { treeTypes.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); islandFlora = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { islandFlora.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); lifepowerAffectionList = new Dictionary <int, float>(); if (count != 0) { data = new byte[8 * count]; fs.Read(data, 0, data.Length); int id = 0; for (i = 0; i < count; i++) { id = i * 8; lifepowerAffectionList.Add(System.BitConverter.ToInt32(data, id), System.BitConverter.ToSingle(data, id + 4)); } } }
// EnvironmentMaster.environmentalConditions //GameMaster.lifegrowCoefficient public static void ResetXStationStaticData() { current = null; envMaster = GameMaster.realMaster.environmentMaster; }
public void Load(System.IO.Stream fs, Chunk c) { env = GameMaster.realMaster.environmentMaster; lifepowerSupport = env.lifepowerSupport; myChunk = c; // var data = new byte[24]; fs.Read(data, 0, data.Length); lifepower = System.BitConverter.ToSingle(data, 0); grasslandCreateTimer = System.BitConverter.ToSingle(data, 4); grasslandsUpdateTimer = System.BitConverter.ToSingle(data, 8); lastUpdateIndex = System.BitConverter.ToInt32(data, 12); lastDonoredIndex = System.BitConverter.ToInt32(data, 16); // int count = System.BitConverter.ToInt32(data, 20), i; grasslands = null; if (count != 0) { grasslands = new List <Grassland>(); var checkList = new HashSet <PlanePos>(); for (i = 0; i < count; i++) { Grassland.Load(fs, myChunk); } var iddata = new byte[4]; fs.Read(iddata, 0, 4); Grassland.SYSTEM_SetNextID(System.BitConverter.ToInt32(iddata, 0)); } // count = fs.ReadByte(); flowerTypes = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { flowerTypes.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); bushTypes = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { bushTypes.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); treeTypes = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { treeTypes.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); islandFloraRegister = new List <PlantType>(); if (count != 0) { for (i = 0; i < count; i++) { islandFloraRegister.Add((PlantType)fs.ReadByte()); } } // count = fs.ReadByte(); lifepowerAffectionList = new Dictionary <int, float>(); if (count != 0) { data = new byte[8 * count]; fs.Read(data, 0, data.Length); int id = 0; for (i = 0; i < count; i++) { id = i * 8; lifepowerAffectionList.Add(System.BitConverter.ToInt32(data, id), System.BitConverter.ToSingle(data, id + 4)); } } }
private void Awake() { emaster = GameMaster.realMaster.environmentMaster; selectedPreset = Environment.EnvironmentPreset.Default; }