Example #1
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);
        }
        void UpdateSprite(ITile tile)
        {
            if (gameobjects.ContainsKey(tile) == false)
            {
                Debug.LogError("Trying to update a tile without a gameobject created.");
                return;
            }

            GameObject tile_go = gameobjects[tile];

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

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

            sr.sprite       = DataManager.tileSpriteData.GetDataById(tile.Type);
            sr.sortingOrder = SortingOrders.FloorOrder(tile.X, tile.Y, FloorSubLayer.FloorTile);
        }
        void UpdateSprite(IWall wall)
        {
            if (gameobjects.ContainsKey(wall) == false)
            {
                return;
            }

            GameObject wall_go = gameobjects[wall];

            wall_go.transform.position = WallTransformer.CoordToWorld(wall.X, wall.Y, wall.Z);

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

            sr.sprite       = DataManager.wallSpriteData.GetDataById(wall.Type).GetSprite(wall, GetClippingForWall(wall));
            sr.sortingOrder = SortingOrders.WallOrder(wall.X, wall.Y, wall.Z, TileSubLayer.Wall);

            //sr.color = Random.ColorHSV(0, 1, 0, 1, 0.4f, 1);
        }