private void OnBuildingUpdate(FurnitureItem furnitureItem) { if (selectFurniture == null) { return; } //可以升级 if (CanUpdateBuilding(furnitureItem)) { //replace furnitureItem.TheInfo.id = selectFurniture.TheInfo.id; furnitureItem.Direction = selectFurniture.Direction; furnitureItem.TheInfo.furnitureType = selectFurniture.TheInfo.furnitureType; var posIndex = selectFurniture.PosIndex; SetFurnitureIndex(furnitureItem, posIndex); placeMgr.ReplacePlaceItem(selectFurniture, furnitureItem); sceneBuildings.Remove(selectFurniture); sceneBuildings.Add(furnitureItem); selectFurniture.Release(); selectFurniture = null; furnitureItem.TheInfo.SetState(true, true); } else { furnitureItem.Release(); furnitureItem = null; } }
public void DeleteSelectBuilding() { colliderFurnitures.Clear(); if (selectFurniture == null || isBuilingCreate) { return; } isBuilingCreate = false; if (onBuildingDelete != null) { onBuildingDelete(selectFurniture.TheInfo.id); } placeMgr.RemovePlaceItem(selectFurniture); selectFurniture.Release(); selectFurniture = null; }
public void CancelBuilding() { colliderFurnitures.Clear(); if (buildingFurniture == null) { return; } if (isBuilingCreate) { buildingFurniture.Release(); } isBuilingCreate = false; buildingFurniture = null; lastFurniture = null; }