Class RewardAsset
An asset for storing a RewardDefinition in your Assets.
Inherited Members
Namespace: UnityEngine.GameFoundation.DefaultCatalog
Syntax
public sealed class RewardAsset : CatalogItemAsset, ISerializationCallbackReceiver
Properties
cooldownDisplayUnits
The units to display cooldown time in on the editor
Declaration
public TimeUnit cooldownDisplayUnits { get; set; }
Property Value
Type | Description |
---|---|
TimeUnit |
cooldownSeconds
The amount of time, in seconds, between when a RewardItem is claimed and when the next one will become available.
Declaration
public ExternalizableValue<int> cooldownSeconds { get; }
Property Value
Type | Description |
---|---|
ExternalizableValue<Int32> |
expirationDisplayUnits
The units to display expiration time in on the editor
Declaration
public TimeUnit expirationDisplayUnits { get; set; }
Property Value
Type | Description |
---|---|
TimeUnit |
expirationSeconds
The amount of time, in seconds, that a RewardItem will be claimable before either moving on to the next RewardItem, or resetting back to the first RewardItem.
Declaration
public ExternalizableValue<int> expirationSeconds { get; }
Property Value
Type | Description |
---|---|
ExternalizableValue<Int32> |
resetIfExpired
If a RewardItem expires, this determines whether the next RewardItem will become available, or if the Reward is reset back to the first RewardItem.
Declaration
public ExternalizableValue<bool> resetIfExpired { get; }
Property Value
Type | Description |
---|---|
ExternalizableValue<Boolean> |
Methods
AwakeDefinition()
Initializes the reward items collection.
Declaration
protected override void AwakeDefinition()
Overrides
ConfigureItem(CatalogBuilder, IExternalValueProvider)
Configures a specified builder
with the specifics
of this item.
Declaration
protected override CatalogItemConfig ConfigureItem(CatalogBuilder builder, IExternalValueProvider valueProvider)
Parameters
Type | Name | Description |
---|---|---|
CatalogBuilder | builder | The target builder. |
IExternalValueProvider | valueProvider | A value provider to override some catalog item's data with an external source. |
Returns
Type | Description |
---|---|
CatalogItemConfig | The item config. |
Overrides
Contains(RewardItemObject)
Tells whether or not the reward contains the given rewardItem
.
Declaration
public bool Contains(RewardItemObject rewardItem)
Parameters
Type | Name | Description |
---|---|---|
RewardItemObject | rewardItem | The RewardItemObject to find. |
Returns
Type | Description |
---|---|
Boolean |
|
FindRewardItem(String)
Looks for a RewardItemDefinition based on its key.
Declaration
public RewardItemObject FindRewardItem(string rewardItemKey)
Parameters
Type | Name | Description |
---|---|---|
String | rewardItemKey | The unique key string of the reward item to find. |
Returns
Type | Description |
---|---|
RewardItemObject | Returns a RewardItemObject if one is found, otherwise null. |
GetRewardItems(ICollection<RewardItemObject>, Boolean)
Adds all the RewardItemObjects to the given target
.
Declaration
public int GetRewardItems(ICollection<RewardItemObject> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
ICollection<RewardItemObject> | target | The target collection where the RewardItemObjects are added. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of RewardItemObject added. |
IndexOf(RewardItemObject)
Get the index of a RewardItemObject in this RewardAsset.
Declaration
public int IndexOf(RewardItemObject rewardItemObject)
Parameters
Type | Name | Description |
---|---|---|
RewardItemObject | rewardItemObject | The reward item object to find the index of. |
Returns
Type | Description |
---|---|
Int32 | The index of the reward item object. |
OnAfterItemDeserialize()
Called at the end of OnAfterDeserialize. Enable inheritance to add specific deserialization process.
Declaration
protected override void OnAfterItemDeserialize()