πHabits Module
Overview
Habits overrides the calendar section of the Time Module allowing for more precise and extensible events within the COZY ecosystem. Automatically setup repeat patterns, start and end times, multi-day events, routines, and multiple calendars all without leaving the COZY editor. Habits is a "no-code-required" event system, but you can also extend in it easily with Habit listeners via the API.
Key Features
Setup robust events
Manage time with a realistic Gregorian calendar and weekdays.
Link events to your world using the Habit Listener script
Profiles
Habits Year
The Habits Year Profile holds references to all of the months of the year (with display names and number of days), the start day of the week, and a list of all of the events used by this calendar. This profile is the core of Habits and provides the module with most of the setup data.
Cozy Habit Profile
The Cozy Habit Module defines the actual events or habits that are triggered in your world. Define repeating patterns, start and end dates, start and end times, and determine when the Habit event is triggered.
While these can be edited in the profiles, it is best to edit them in the actual module UI.
Usage Examples
Understanding the UI
Habits is visible in three different sections that all have different levels of detail and have pros and cons when it comes to editing.
The Toolbar
Each view has a toolbar in the bottom-right corner that lets you add a Habit (new or existing), see and edit the full list of active Habits, and edit the global editor settings to show/hide calendars.
Month View
See the whole month at a glance. See the number of events on all of the days of the month as well as track the weekdays. Select a new day on the calendar to swap to that day. Select the month name at the top of the screen to change the month or use the [ + ] and [ - ] buttons to raise or lower the current month.
Week View
See the current week at a glance. See a few details about each day and look at the Habits that play on each. The white line across all of the days shows you the current time, clicking the day initial will swap to that day and clicking on each Habit's name will let you edit that Habit.
Day View
See all the Habits for today in detail. The white line across all of the days shows you the current time, clicking the plus and minus buttons will increase and decrease the current day, and clicking on each Habit's name will let you edit that Habit.
Habits Listeners
COZY Habit Listeners let you link your Habits directly to Unity Events in the inspector with no code.
Select the Habit that you want to use for the event in the first field and setup your Unity Events in the fields below it. Start Event will be called when the Habit starts playing, Update Event is called every frame that the Habit is active, and End Event is called the last frame that the Habit is active.
API
C# Event Listeners
You can also set up events using C# instead of Cozy Habit Listeners. This is the format that you need to follow to include Habits in your scripts
Last updated