public float GoalEfficiencyScale(GridLevelData.Goal goal) { var goalVolume = goal.volume * instance.levelData.unitVolume; var s = goalVolume.fValue / volume.fValue; return(Mathf.Clamp01(s)); }
public bool GoalIsVolumeMet(GridLevelData.Goal goal) { //TODO: conversion? var goalVolume = goal.volume * instance.levelData.unitVolume; return(volume >= goalVolume); }
public bool GoalIsHeightMet(GridLevelData.Goal goal) { if (goal.unitHeightRequire <= 0) { return(true); } var heightReq = goal.unitHeightRequire * instance.levelData.sideMeasure; return(maxHeight <= heightReq); }
public void Setup(GridLevelData.Goal goal) { icon.sprite = goal.data.icon; titleText.text = M8.Localize.Get(goal.data.nameTextRef); mSB.Clear(); mSB.Append("· "); mSB.Append(M8.Localize.Get(volumeReqTextRef)); var editCtrl = GridEditController.instance; var goalVolume = goal.volume * editCtrl.levelData.unitVolume; //goalVolume.SimplifyImproper(); //goalVolume.Simplify(); goalVolume.FractionToWhole(); var goalHeight = goal.unitHeightRequire * editCtrl.levelData.sideMeasure; goalHeight.SimplifyImproper(); if (goalHeight.fValue > 0f) { mSB.Append('\n'); mSB.Append("· "); mSB.Append(M8.Localize.Get(heightReqTextRef)); } descText.text = mSB.ToString(); mSB.Clear(); mSB.Append(UnitMeasure.GetVolumeText(goal.measureType, goalVolume)); if (goalHeight.fValue > 0f) { mSB.Append('\n'); mSB.Append(UnitMeasure.GetMeasureText(goal.measureType, goalHeight)); } valueText.text = mSB.ToString(); }