Timeboard Events

v4.0

Timeboard

Timeboard will handle all of the Gametime updates, and can be used for pausing the game as well. There are options to send events from the Blackboard on PauseLevel changes, or when key date/times change.

Other scripts can implement IFollowBlackboard and subscribe to the Blackboard, or simply inherit from TimeboardFollower, which provides virtual methods that do all the subscriptions for you.

Bring the Timeboard prefab into your project to easily use the Gametime module.

When an event is received from the Timeboard.Blackboard, the topic will always be "Gametime". Subject will describe what information has changed. The status will be a string, and the obj is an object. You will need to cast the obj value as an int: event.obj as int

Day will return 0 on the first day of the month in the obj value.

Week will return a string "1" on the first week of the year, and 0 in the obj value.

TopicSubjectStatus (string)Obj (Object)

Gametime

Pause Level

--

int pauseLevel

Gametime

Minute

string two-digit minute

int minute

Gametime

Hour

string two-digit hour

int hour

Gametime

Day

string day name

int day number (first day = 0)

Gametime

Week

string one-digit week (shifted for humans)

int week number (first week = 0)

Gametime

Month

string month name

int month index

Gametime

Season

string season name

int season index

Gametime

Year

string year number

int year number

// Example code in a script which inherits from TimeboardFollower, that only
// cares about updates to the in-game season.

public string topicToWatch = "Gametime";
public string subjectToWatch = "Season";
private string _seasonName;

public override void ReceiveEvent(BlackboardEvent blackboardEvent){
    if (blackboardEvent.topic != topicToWatch
      || blackboardEvent.subject != subjectToWatch)
         return;
   
   _seasonName = blackboardEvent.status; // Save the string
   // Optionally do something else, like update UI Text, play a sound, change
   // the graphics, or music, or anything else!
}

Last updated