Feel  5.2
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMLootTable< T, V > Class Template Reference

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
 

Detailed Description

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

Template Parameters
T
V
Type Constraints
T :MMLoot<V> 

Member Function Documentation

◆ ComputeWeights()

virtual void MoreMountains.Tools.MMLootTable< T, V >.ComputeWeights ( )
virtual

Determines, for each object in the table, its chance percentage, based on the specified weights

◆ GetLoot()

virtual T MoreMountains.Tools.MMLootTable< T, V >.GetLoot ( )
virtual

Returns one object from the table, picked randomly

Returns

Member Data Documentation

◆ _maximumWeightSoFar

float MoreMountains.Tools.MMLootTable< T, V >._maximumWeightSoFar = 0f
protected

◆ _weightsComputed

bool MoreMountains.Tools.MMLootTable< T, V >._weightsComputed = false
protected

◆ ObjectsToLoot

List<T> MoreMountains.Tools.MMLootTable< T, V >.ObjectsToLoot

the list of objects that have a chance of being returned by the table

◆ WeightsTotal

float MoreMountains.Tools.MMLootTable< T, V >.WeightsTotal

the total amount of weights, for debug purposes only


The documentation for this class was generated from the following file: