TopDown Engine
v4.1
|
A loot table helper that can be used to randomly pick objects out of a weighted list This design pattern was described in more details by Daniel Cook in 2014 in his blog : https://lostgarden.home.blog/2014/12/08/loot-drop-tables/ More...
Public Member Functions | |
virtual void | ComputeWeights () |
Determines, for each object in the table, its chance percentage, based on the specified weights More... | |
virtual T | GetLoot () |
Returns one object from the table, picked randomly More... | |
Public Attributes | |
List< T > | ObjectsToLoot |
the list of objects that have a chance of being returned by the table More... | |
float | WeightsTotal |
the total amount of weights, for debug purposes only More... | |
Protected Attributes | |
float | _maximumWeightSoFar = 0f |
bool | _weightsComputed = false |
A loot table helper that can be used to randomly pick objects out of a weighted list This design pattern was described in more details by Daniel Cook in 2014 in his blog : https://lostgarden.home.blog/2014/12/08/loot-drop-tables/
This generic LootTable defines a list of objects to loot, each of them weighted. The weights don't have to add to a certain number, they're relative to each other. The ComputeWeights method determines, based on these weights, the chance percentage of each object to be picked The GetLoot method returns one object, picked randomly from the table
T | |
V |
T | : | MMLoot<V> |
|
virtual |
Determines, for each object in the table, its chance percentage, based on the specified weights
|
virtual |
Returns one object from the table, picked randomly
|
protected |
|
protected |
List<T> MoreMountains.Tools.MMLootTable< T, V >.ObjectsToLoot |
the list of objects that have a chance of being returned by the table
float MoreMountains.Tools.MMLootTable< T, V >.WeightsTotal |
the total amount of weights, for debug purposes only