예제 #1
0
    private void UpdateCameraLimit()
    {
        WorldMap.CompressBounds();
        float   cellSize         = WorldMap.cellSize.x;
        Vector2 cellZeroPosition = WorldMap.CellToWorld(new Vector3Int(WorldMap.cellBounds.xMin, WorldMap.cellBounds.yMin, 0));

        minMaxXPosition = new Vector2(cellZeroPosition.x + CameraSize.x / 2 - borderOffset,
                                      cellZeroPosition.x + WorldMap.size.x * cellSize - CameraSize.x / 2 + borderOffset);
        minMaxYPosition = new Vector2(cellZeroPosition.y + CameraSize.y / 2 - borderOffset,
                                      cellZeroPosition.y + WorldMap.size.y * cellSize - CameraSize.y / 2 + borderOffset);
        Debug.Log("Camera min/max position: x: " + minMaxXPosition + " y: " + minMaxYPosition);
    }