public void CitizenDestroy(EditorCitizen editorCitizen) { citizenList.Remove(editorCitizen); Destroy(editorCitizen.gameObject); transform.parent.GetComponent <Editor_Mnr>().ResetCitizensCnt(); CitizenIDReset(); }
public EditorCitizen Citizens_Crt(Citizen_Type citizen) { EditorCitizen citizen_obj = Instantiate(Resources.Load <EditorCitizen>("EditorObj/EditorCitizen"), transform); citizen_obj.Citizen_set(citizen); citizen_obj.editorStage = this; citizenList.Add(citizen_obj); CitizenIDReset(); return(citizen_obj); }
IEnumerator LoadDoing(StageAllSaveData stageAllSaveData) { int before_currentStageIndex = currentStageIndex; foreach (var stage in stageList) { Destroy(stage.gameObject, 0.1f); } stageList.Clear(); foreach (var stageSaveData in stageAllSaveData.stageList) { StageCreate(); stageList[currentStageIndex].minClearTime = stageSaveData.minClearTime; stageList[currentStageIndex].minRedCitizen = stageSaveData.minRedCitizen; stageList[currentStageIndex].maxRedTile = stageSaveData.maxRedTile; while (stageList[currentStageIndex].tiles.Count == 0) { yield return(new WaitForEndOfFrame()); } yield return(new WaitForEndOfFrame()); foreach (var tile in stageSaveData.tileList) { if (tile.tile_Type != Tile_Type.None && tile.tile_Type != Tile_Type.White) { EditorTile editorTile = stageList[currentStageIndex].tiles.Find(tileobj => tileobj.pos == tile.pos); if (editorTile != null) { editorTile.TileChange(tile.tile_Type); } } } ChangeTileOn(); foreach (var citizen in stageSaveData.citizenList) { EditorCitizen editorCitizen = stageList[currentStageIndex].Citizens_Crt(citizen.citizen_Type); editorCitizen.pos = citizen.pos; editorCitizen.citizen_Type = citizen.citizen_Type; editorCitizen.id = citizen.id; editorCitizen.SetColor(citizen.citizenColor); //editorCitizen.citizen_color = citizen.citizenColor; EditorTile editorTile = stageList[currentStageIndex].tiles.Find(tileobj => tileobj.pos == citizen.pos); if (editorTile != null) { editorCitizen.ResetPos(editorTile); } } ResetCitizensCnt(); foreach (var building in stageSaveData.buildingList) { EditorBuilding editorBuilding = stageList[currentStageIndex].Build_Crt(building.buildingType); editorBuilding.pos = building.pos; stageList[currentStageIndex].BuildIDReset(); editorBuilding.chitizen_normal_num = building.chitizen_normal_num; editorBuilding.chitizen_young_num = building.chitizen_young_num; editorBuilding.chitizen_old_num = building.chitizen_old_num; editorBuilding.chitizen_The_num = building.chitizen_The_num; EditorTile editorTile = stageList[currentStageIndex].tiles.Find(tileobj => tileobj.pos == building.pos); if (editorTile != null) { editorBuilding.ResetPos(editorTile); } } } stageNameDropDown.value = before_currentStageIndex; }
public void SetSelectCitizen(EditorCitizen citizen) { this.select_Citizen_Obj = citizen; transform.parent.GetComponent <Editor_Mnr>().CurrentCitizenChange(); }
public void ChangeCitizen(EditorCitizen citizen) { this.citizen = citizen; nameText.text = this.citizen.GetName(); selectToggleList[(int)citizen.citizen_color].isOn = true; }