Add Challenge Events

Time Based

Adding Time Based win condition within your game code requires an eventName string and the start time and end time. Start and end time can be sent either separately like in Example 1 or in a single event like in Example 2:

Stay alive for 2 hours in the next 2 days

// Example 1: Separate start and end events
// StartEvent(string _str_eventName, DateTime _dt_start);
// EndEventAndPost(string _str_eventName, ?DateTime dt_end);

Versus.VersusManager.Singleton.StartEvent("Stay alive", ?DateTime dt_start);
Versus.VersusManager.Singleton.EndEventAndPost("Stay alive", ?DateTime dt_end);

// Example 2: Single event
// PostEvent(string _str_eventName, DateTime _dt_start, DateTime _dt_end);

Versus.VersusManager.Singleton.PostEvent("Stay alive", ?DateTime dt_start, ?DateTime dt_end);

🚧

Note:

?DateTime, dt_start is optional for StartEvent and ?DateTime, dt_end is optional for EndEventAndPost. Both will be registered as “now” if no value is passed.

Event Based

Adding Event Based win condition within your game code requires an eventName string and a value integer. The value integer can be higher than one per Example 2 below:

Pick up 50 gold coins in the next 5 days.

// Example 1: One coin picked up
// PostEvent(string _str_eventName, int _n_value = 1);

Versus.VersusManager.Singleton.PostEvent("Pick up gold coins", 1);

// Example 2: One red coin worth 5 coins picked up
// PostEvent(string _str_eventName, int _n_value = 5);

Versus.VersusManager.Singleton.PostEvent("Pick up gold coins", 5);

Stacked

Add Stacked win conditions within your game code in the same manner as you would implement Time Based & Event Based win condition above.

Event Based + Time Based
Pick up 50 gold coins and stay alive for 2 hours in the next 3 days

Versus.VersusManager.Singleton.PostEvent("Pick up gold coins", 1);
Versus.VersusManager.Singleton.StartEvent("Stay alive", ?DateTime dt_start);
Versus.VersusManager.Singleton.EndEventAndPost("Stay alive", ?DateTime dt_end);