Class RewardDefinition
A plan for rewarding a player based on a schedule. Different Rewards will have different schedules and different RewardItemDefinitions.
Inherited Members
Namespace: UnityEngine.GameFoundation
Syntax
public class RewardDefinition : CatalogItem, IEquatable<CatalogItem>, IComparable<CatalogItem>
Properties
cooldownSeconds
The amount of time, in seconds, between when a RewardItem is claimed and when the next one will become available.
Declaration
public int cooldownSeconds { get; }
Property Value
Type | Description |
---|---|
Int32 |
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 int expirationSeconds { get; }
Property Value
Type | Description |
---|---|
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 bool resetIfExpired { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Contains(RewardItemDefinition)
Tells whether or not the reward contains the given rewardItem
.
Declaration
public bool Contains(RewardItemDefinition rewardItem)
Parameters
Type | Name | Description |
---|---|---|
RewardItemDefinition | rewardItem | The RewardItemDefinition to find. |
Returns
Type | Description |
---|---|
Boolean |
|
FindRewardItem(String)
Looks for a RewardItemDefinition based on its key.
Declaration
public RewardItemDefinition FindRewardItem(string rewardItemKey)
Parameters
Type | Name | Description |
---|---|---|
String | rewardItemKey | The unique key string of the reward item to find. |
Returns
Type | Description |
---|---|
RewardItemDefinition | Returns a RewardItemDefinition if one is found, otherwise null. |
GetRewardItems(ICollection<RewardItemDefinition>, Boolean)
Adds all the RewardItemDefinitions to the given target
.
Declaration
public int GetRewardItems(ICollection<RewardItemDefinition> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
ICollection<RewardItemDefinition> | target | The target collection where the RewardItemDefinitions are added. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of RewardItemDefinition added. |
IndexOf(String)
Get the index of a RewardItemDefinition in this Reward.
Declaration
public int IndexOf(string rewardItemKey)
Parameters
Type | Name | Description |
---|---|---|
String | rewardItemKey | The key of the reward item to find. |
Returns
Type | Description |
---|---|
Int32 | The index of the reward item. |
IndexOf(RewardItemDefinition)
Get the index of a RewardItemDefinition in this Reward.
Declaration
public int IndexOf(RewardItemDefinition rewardItem)
Parameters
Type | Name | Description |
---|---|---|
RewardItemDefinition | rewardItem | The reward item to find. |
Returns
Type | Description |
---|---|
Int32 | The index of the reward item. |