void RebuildVisualization(LevelFormula formula) { if (showCurve == null) { showCurve = new AnimationCurve(); } ClearCurve(); samplesString = "Level\tPointsNeeded\tPoints Delta (From Last Level Up)\n\n"; int lastNeeded = (int)formula.PointsThreshold(samplesStart - 1); for (int i = 0; i < samplesRange; i++) { int l = samplesStart + i; int needed = (int)formula.PointsThreshold(l); int delta = needed - lastNeeded; lastNeeded = needed; if (curveShowMode == CurveShowMode.PointsCap) { showCurve.AddKey(l, needed); } else if (curveShowMode == CurveShowMode.PointsDifference) { showCurve.AddKey(l, delta); } samplesString += l + "\t" + needed.LargeNumberToString() + "\t\t+" + delta.LargeNumberToString() + "\n"; } curveDrawer.OnDisable(); }
void BroadcastPointsChange01(int basePoints, int basePointsDelta, int level) { if (onPointsChange01 != null) { int lastLevelPoints = (int)levelFormula.PointsThreshold(level); int nextLevelPoints = (int)levelFormula.PointsThreshold(level + 1); float range = nextLevelPoints - lastLevelPoints; float targetT = (basePoints - lastLevelPoints) / range; float lastT = Mathf.Max((basePoints - basePointsDelta) - lastLevelPoints, 0f) / range; onPointsChange01(targetT, lastT); } }