예제 #1
0
    private void SetInteriorMode(bool isEnable, FurnitureController furnitrueConroller = null)
    {
        var prevFurnitureController = selectedFurnitureController == null ? furnitrueConroller : selectedFurnitureController;

        prevFurnitureController.IsInteriorMode = isEnable;

        selectedInteriorTileMap = prevFurnitureController.Furniture.GetType() == typeof(Door) ? doorTileMap : interiorTileMap;

        selectedFurnitureController = furnitrueConroller;

        doorTileMap.IsInteractionEnable     = !isEnable;
        interiorTileMap.IsInteractionEnable = !isEnable;

        var draggableObject = prevFurnitureController.PreviewObject.GetComponent <DraggableObject>();

        if (!isEnable)
        {
            draggableObject.onDragging.RemoveListener(SelectedFurnitureMoveTo);
        }
        else
        {
            draggableObject.onDragging.AddListener(SelectedFurnitureMoveTo);
        }

        selectedFloor.SetArragnedFurnituresInteractionEnable(!isEnable);
        furnitureBuildButtonTransform.gameObject.SetActive(isEnable);
    }
    public void Setup(InteriorTileMap2D ownerTileMap, InteriorTileState tileState, Vector2Int mapStartIndex)
    {
        var collider = GetComponent <BoxCollider2D>();

        collider.isTrigger = true;

        spriteRenderer = GetComponent <SpriteRenderer>();

        OwnerTileMap  = ownerTileMap;
        MapStartIndex = mapStartIndex;
        ChangeState(tileState);
    }
예제 #3
0
    public void LinkFurnitureToTiles(InteriorTileMap2D tileMap, Furniture furnitrue, Vector2Int linkStartTileIndex, Vector2Int furnitrueTileSzie)
    {
        Vector2Int tileEndIndex = linkStartTileIndex + furnitrueTileSzie;

        for (int column = linkStartTileIndex.y; column < tileEndIndex.y; column++)
        {
            for (int row = linkStartTileIndex.x; row < tileEndIndex.x; row++)
            {
                var interiorTile = tileMap[column, row];
                interiorTile.LinkedFurniture = furnitrue;
            }
        }
    }