Every formula should have one and only one output. The basic formula class is:
public abstract class Formula<OUTPUT_TYPE> {}
All custom formulas should be derived from this class.
On this basis, we construct two types of formulas, Cache, and Pure Formula.
T, the output type, the type you want to cache.IC, the type of Item Component.public abstract class ItemAttributeCacheFormula<T, IC> : Formula<T> {}
For example, the int cache formula would be like this.
public class IntCacheFormula : ItemAttributeCacheFormula<int, IntComponent> {}
According to this format, you can replace the corresponding data type and Item Component.
The following shows the AllCache formula.
public abstract class ItemAttributeAllCacheFormula<T, IC> : Formula<List<T>> {}
public class Vector3AllCacheFormula :
ItemAttributeAllCacheFormula<Vector3, Vector3Component> {}