so every time I try to do this task, building a lookup table scriptable object, my brain goes into complete melt down and tries to convince me that “This is not the path I’m looking for”. would someone be so kind as to check my code to see if I’ve missed something?
This progression table will store three different progression rates (good, fair, poor) for four stats (attacks/Round, fortSave, reflexSave, willSave).
using UnityEngine;
using RPG.Core;
using System.Collections.Generic;
public class StatProgression : ScriptableObject
{
[SerializeField] StatProgressionRate[] statProgressionRates;
Dictionary<string, Dictionary<string, float[]>> progressionLookup = new Dictionary<string, Dictionary<string, float[]>>();
void BuildLookup()
{
if (progressionLookup != null) { return; }
progressionLookup = new Dictionary<string, Dictionary<string, float[]>>();
foreach (StatProgressionRate pRate in statProgressionRates)
{
var statLookup = new Dictionary<string, float[]>();
foreach (CharacterStatProgression cStat in pRate.stats)
{
statLookup[cStat.stat.ToString()] = cStat.levels;
}
progressionLookup[pRate.rate.ToString()] = statLookup;
}
}
[System.Serializable] class StatProgressionRate
{
public ProgressionRate rate;
public CharacterStatProgression[] stats;
}
[System.Serializable] class CharacterStatProgression
{
public CharacterStat stat;
public float[] levels;
}
}
Thank you for your time!