Пример #1
0
        public static UniqueBuilding GetImmediateCopy(this BuildingInfo oldInfo, string newName, string newDescription = "", ushort buildingID = 0)
        {
            string oldName = oldInfo.name;

            oldInfo.CopyInfo(newName);
            PrefabCollection <BuildingInfo> .BindPrefabs();

            oldInfo.CopyFields(newName);
            BuildingInfo newInfo = PrefabCollection <BuildingInfo> .FindLoaded(newName);

            if (buildingID != 0)
            {
                BuildingManager.instance.m_buildings.m_buffer[buildingID].Info = newInfo;
                BuildingManager.instance.UpdateBuildingRenderer(buildingID, true);
                BuildingManager.instance.UpdateBuildingInfo(buildingID, newInfo);
            }
            return(new UniqueBuilding(newInfo, oldName, newName, newDescription));
        }