Activation Groups (v1.2)

Activation Groups provide a simple concept that opens up a number of possibilities: an activation group is simply a collection of related items which can be toggled on (activated) and off (deactivated).

Activation Groups have various options:

Group Name Identifier for the group (used in events and persistence).
Only One Active If true only one activation item can be active at a time. When an item is activated the currently activated item will be deactivated. If Default Item is specified and the activate item is deactivated then the default item will be automatically activated.
Require Matching Item If ticked the activation items can only be activated if a character has the matching item in their inventory (Item Manager).
Default Item Item to activate by default.
Items A list of items in the group. If Require Matching Item is set these should match the item type.
Persistence Standard persistence options.


Interacting with Activation Groups

You can activate and deactivate items in the group using either code or an EventResponder action.

Activating and Deactivating via code

Use the following methods to interact with an Activation Group via code:

/// <summary>
/// Activate the specified itemId.
/// </summary>
/// <param name="itemId">Item identifier.</param>
/// <returns>true if the item was activated or the item was already activated</returns>
virtual public bool Activate(string itemId)

/// <summary>
/// Deactivate the specified itemId.
/// </summary>
/// <param name="itemId">Item identifier.</param>
/// <returns>true if the item was deactivated or the item was already deactivated</returns>
virtual public bool Deactivate(string itemId)

Activating via an Event Responder Action

You can use the Activation Group/Activate and ActivationGroup/Deactivate actions to interact with Activation Groups in an EventResponder (or other Responder):

You can then assign the ActivationGroup component to the Activation Group field and then set the activation item id in the field Activation Item field.

Listening to Activation Group Events

Activation Groups send the following events which you can use to do something when the activation group changes:

Activated Sent when an item is activated.
Deactivated Sent when an item is deactivated.
AllActivated Sent when all items in the group become activated. Useful for puzzles where a player needs to complete a number of items.

Activation Group Usages

Here are some ideas for how Activation Groups can be used:

Weapons A group with Only One Active flag can be used as the basis for a switchable weapon system. By tying the Activation Items to an ItemManager you can ensure weapons are only available if the ammo is available. See: SampleScene-CommandBro scene.
Progress When a character collects items or enters specific areas you can use an activation group to track what they have done. For example each hostage in a rescue game could be an item in an activation group when all hostages are rescued you can trigger a rescue helicopter, big boss, etc. No sample available. Why not create one?
Puzzles Often puzzles have several pieces that need to be completed. Use an activation group to track the completion state of each piece then use EventResponders to open doors or otherwise respond to the puzzle. See: PlatformSamples-Puzzles2 scene.






Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk