using UnityEngine;
namespace MoreMountains.Tools
{
///
/// A scriptable object containing a MMLootTable definition for game objects
///
[CreateAssetMenu(fileName="LootDefinition",menuName="MoreMountains/Loot Definition")]
public class MMLootTableGameObjectSO : ScriptableObject
{
/// the loot table
public MMLootTableGameObject LootTable;
/// returns an object from the loot table
public virtual GameObject GetLoot()
{
return LootTable.GetLoot()?.Loot;
}
///
/// computes the loot table's weights
///
public virtual void ComputeWeights()
{
LootTable.ComputeWeights();
}
protected virtual void OnValidate()
{
ComputeWeights();
}
}
}