示例#1
0
    private void Start()
    {
        for (int x = 0; x < TileController.x_max_value; x++)
        {
            for (int y = 0; y < TileController.y_max_value; y++)
            {
                EditorTile tileobj = Instantiate(Resources.Load <EditorTile>("EditorObj/EditorTile"), transform);
                tileobj.pos = new Vector2(x, y);
                //tileobj.transform.localPosition = new Vector2(40f * x, 33.3f * y);
                tileobj.transform.localPosition = new Vector2(55f * x, 40f * y);
                tileobj.TileChange(Tile_Type.White);
                tileobj.Tile_mng = this;
                if (y < 4 && (x <= 2 || x >= 12))
                {
                    tileobj.TileChange(Tile_Type.None, true);
                }
                //클릭시 호출 이벤트 등록
                tileobj.clickEvent += ChangeTileType;

                tiles.Add(tileobj);
            }
        }

        transform.parent.GetComponent <Editor_Mnr>().ChangeTileOn();
    }
示例#2
0
 void PreInteractTile(EditorTile tile)
 {
     if (color == CitizenColor.Red)
     {
         if (tile.tile_Type == Tile_Type.White)
         {
             tile.TileChange(Tile_Type.Red);
         }
         else if (tile.tile_Type == Tile_Type.Blue)
         {
             tile.TileChange(Tile_Type.White);
         }
     }
 }
示例#3
0
    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;
    }
示例#4
0
 /// <summary>
 /// 타일의 타입변경
 /// </summary>
 /// <param name="tile_Type"></param>
 public void ChangeTileType(EditorTile tile)
 {
     tile.TileChange(select_Tile_Type);
     transform.parent.GetComponent <Editor_Mnr>().ChangeTileOn();
 }