# Blocks Module

## Overview

Control your skies using specific time blocks instead of gradients. Blocks has support for 7 different time blocks every day that you can assign a specific color block (static snapshot of an [Atmosphere Profile](../profiles/atmosphere-profile)) to. COZY will then interpolate the atmosphere colors between these Color Blocks automatically giving you more intuitive control over your lighting, colors, and FX.

Blocks allows users to customize their environment according to seven distinct time blocks each day. By selecting specific colors or atmospheres for these blocks, users can create seamless transitions that enhance the ambiance of their space throughout the day.

{% hint style="info" %}
**Blocks** is an extension module for COZY 3 that is available for purchase [separately](https://assetstore.unity.com/packages/tools/utilities/blocks-atmosphere-control-module-for-cozy-3-238051).&#x20;
{% endhint %}

### Key Features

* **Custom Time Blocks:** Define up to 7 unique time blocks per day to customize your environment's lighting and atmosphere.
* **Color Block Assignment:** Assign specific colors or atmosphere profiles to each time block for unique environmental effects.
* **Random Selection:** Assign multiple color blocks to the same time slot and the Blocks module will automatically pick a random color based on a [weighted random value](../weighted-random-chance-wrc).
* **Intuitive Control Interface:** Easily select and modify your color blocks and time settings through a user-friendly interface.

## Distinguishing the Profiles

Blocks has three major scriptable object profiles that it uses for the basic functionality. They have similar names, so it is important to distinguish them.

### Block Profile

<figure><img src="https://2041269432-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrqKsGNTyQFMrNJSWMHS0%2Fuploads%2Fdru8GWuGVN90nGUWjyxg%2Fimage.png?alt=media&#x26;token=215bc7ed-6f9d-4202-ba51-091d5dddbf62" alt="" width="563"><figcaption></figcaption></figure>

The **Block Profile** is used as the link between the Time Blocks and the Color Blocks. Determine what Time Blocks are used and assign a list of Color Blocks to each.&#x20;

### Time Blocks

<figure><img src="https://2041269432-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrqKsGNTyQFMrNJSWMHS0%2Fuploads%2FUIKULJQzbqLR58v0TaYO%2Fimage.png?alt=media&#x26;token=821e03cd-a3da-478c-9ca0-a02fc9d498cb" alt="" width="563"><figcaption></figcaption></figure>

**Time Blocks** are setup in the [Transit Module](transit-module) and break the COZY time loop into digestible chunks. The **Start** and **End** variables refer to the start and end of the transition, _not_ the start and end of the actual Time Block. For example, in the above screenshot the morning block will transition into the day block from 7:30 to 9:00, and the day block will go from 9:00 to 13:00 where it will transition to the afternoon block from 13:00 to 14:00.

### Color Block

<figure><img src="https://2041269432-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrqKsGNTyQFMrNJSWMHS0%2Fuploads%2FdOmwi0UYfSvbFhlPm4mz%2Fimage.png?alt=media&#x26;token=5feb43e9-cb14-44d0-9815-30ac8f18c3e1" alt="" width="563"><figcaption></figcaption></figure>

The **Color Block** profile refers to the actual preset atmosphere condition and colors. These profiles hold the [_chance_ ](../weighted-random-chance-wrc)for each preset and the access to the colors of the preset. These variables follow the same schematic as the variables for the [Atmosphere Profile](../profiles/atmosphere-profile), however these are always static.

## How it Works

Blocks provides users a new method for coloring their skies. While the default [Atmosphere Module](atmosphere-module) uses gradients to determine the color of the sky throughout the day, Blocks provides a more accessible method for this by setting predetermined times of the day and associating pre-set atmosphere colors (known as Color Block Profiles) with them.

You can also assign multiple Color Block Profiles to the same time slot and one will be randomly selected at runtime. This lets you add some pseudo randomness to your sky and keep your skies variated and interesting.

## Usage Examples

### Setting up Time Blocks

You can set up the times that Color Blocks will change in the [Transit Module](transit-module).&#x20;

<figure><img src="https://2041269432-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrqKsGNTyQFMrNJSWMHS0%2Fuploads%2FUIKULJQzbqLR58v0TaYO%2Fimage.png?alt=media&#x26;token=821e03cd-a3da-478c-9ca0-a02fc9d498cb" alt="" width="563"><figcaption></figcaption></figure>

### Test Blocks in the Editor

Blocks has a development toolkit that you can use to test the colors of your Color Blocks in edit mode.

To use this, simply drag and drop a Color Block into the `Test Color Block` field. You can also use this to see what Color Block is currently being used to color the sky.

<figure><img src="https://2041269432-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrqKsGNTyQFMrNJSWMHS0%2Fuploads%2FaUBLP23TteeDpAecjqVy%2Fimage.png?alt=media&#x26;token=32fb499e-4b13-42ff-b9c8-c027fd91b0ba" alt="" width="563"><figcaption></figcaption></figure>
