Overview

Create a system which allows game designers to create various keys for a game without changing the code.

This system consists of:

  1. Key Ring Component
  2. Lock Component
  3. Key Type

Key Ring Component

A simple component which allows to store and control acquired keys.

The component should have these parameters, functions, and callbacks.

FUNCTION DESCRIPTION
AddKey Adds a given KeyType to an array of acquired keys if it’s not acquired
RemoveKey Removes a given KeyType from an array of acquired keys if it’s acquired
HasKey Check if a given KeyType is in the array of acquired keys
UseKey Uses a given KeyType if it’s in the array of acquired keys
CALLBACK DESCRIPTION
OnKeyAdded Called when a new key was added
OnKeyRemoved Called when a key was removed
OnKeyUsed Called when a key is used

Lock Component

A component which controls the lock state of an owner.

The component should have these parameters, functions, and callbacks.

PARAMETER DESCRIPTION
IsLocked Determines the initial state of the component
RequiredKey Determines KeyType required to change a component state
FUNCTION DESCRIPTION
Lock Changes a component state to Locked
Unlock Changes a component state to Unlocked
CALLBACK DESCRIPTION
OnLocked Called when a component state is changed to Locked
OnUnlocked Called when a component state is changed to Unlocked

Key Type

A light-weight object which

  1. Represents a key as an object