public IWorldCommand Excecute()
        {
            ITile tile = level.GetTileAt(posX, posY);

            if (tile.HasFurniture() == false)
            {
                return(NullCommand.instance);
            }

            IFurniture previousFurniture = tile.GetPlacedFurniture();

            tile.RemoveFurniture();

            return(new PlaceFurnitureCommand(level, posX, posY, previousFurniture));
        }
Пример #2
0
        void UpdateSprite(ITile tile)
        {
            if (gameobjects.ContainsKey(tile) == false)
            {
                Debug.LogError("Trying to update a furni without a gameobject created.");
                return;
            }

            GameObject furni_go = gameobjects[tile];

            furni_go.transform.position = (Vector3)TileTransformer.CoordToWorld(tile.X, tile.Y);

            SpriteRenderer sr = furni_go.GetComponent <SpriteRenderer>();

            sr.sprite       = DataManager.furnitureSpriteData.GetDataById(tile.GetPlacedFurniture().GetIndex()).GetSprite(tile.GetPlacedFurniture());
            sr.sortingOrder = SortingOrders.TileOrder(tile.X, tile.Y, TileSubLayer.Furniture);
        }