예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
        }
예제 #3
0
        public void CancelBuilding()
        {
            colliderFurnitures.Clear();
            if (buildingFurniture == null)
            {
                return;
            }
            if (isBuilingCreate)
            {
                buildingFurniture.Release();
            }

            isBuilingCreate   = false;
            buildingFurniture = null;
            lastFurniture     = null;
        }