public void Init(EconomicSystemData data, GameObject placePrefab, GameObject ecoPlayerGroupPrefab, GameObject ecoPlayerPrefab) { ecoSysdata = data; this.placePrefab = placePrefab; this.ecoPlayerGroupPrefab = ecoPlayerGroupPrefab; this.ecoPlayerPrefab = ecoPlayerPrefab; ecoPlayerGroupModelDic = new Dictionary <int, EcoPlayerGroupModel>(); targetPlaceModelDic = new Dictionary <int, TargetPlaceModel>(); placeParent = new GameObject("placeParent"); placeParent.transform.parent = transform; placeParent.transform.position = Vector3.zero; placeParent.transform.eulerAngles = Vector3.zero; ecoPlayerGroupParent = new GameObject("ecoPlayerGroupParent"); ecoPlayerGroupParent.transform.parent = transform; ecoPlayerGroupParent.transform.position = Vector3.zero; ecoPlayerGroupParent.transform.eulerAngles = Vector3.zero; foreach (KeyValuePair <int, EcoPlayerGroupData> i in ecoSysdata.groupsDicById) { AddEcoPlayerGroupModelByData(i.Value); } foreach (KeyValuePair <int, TargetPlaceData> i in ecoSysdata.placesDicById) { AddPlaceModelByData(i.Value); } }
void Init() { economicSystemUI = gameObject.AddComponent <EconomicSystemUI>(); ecoSysData = new EconomicSystemData(); EcoPlayerData tempPlayer = new EcoPlayerData(-1, 10000, 10000, 50, 50, 50, 50, 50, 50, 100, 1); ecoSysData.AddGroupData(tempPlayer, 30); ecoSysData.AddPlaceData(TargetPlaceType.City); ecoSysLogic = new EconomicSystemLogic(ecoSysData); ecoSysModel = gameObject.AddComponent <EconomicSystemModel>(); ecoSysModel.Init(ecoSysData, placePrefab, groupPrefab, ecoPlayerPrefab); }
public EconomicSystemLogic(EconomicSystemData data) { ecoSysdata = data; ecoPlayerGroupLogicDic = new Dictionary <int, EcoPlayerGroupLogic>(); targetPlaceLogicDic = new Dictionary <int, TargetPlaceLogic>(); foreach (KeyValuePair <int, EcoPlayerGroupData> i in ecoSysdata.groupsDicById) { AddEcoPlayerGroupLogicByData(i.Value); } foreach (KeyValuePair <int, TargetPlaceData> i in ecoSysdata.placesDicById) { AddPlaceLogicByData(i.Value); } }