Exemple #1
0
        public float GoalEfficiencyScale(GridLevelData.Goal goal)
        {
            var goalVolume = goal.volume * instance.levelData.unitVolume;
            var s          = goalVolume.fValue / volume.fValue;

            return(Mathf.Clamp01(s));
        }
Exemple #2
0
        public bool GoalIsVolumeMet(GridLevelData.Goal goal)
        {
            //TODO: conversion?
            var goalVolume = goal.volume * instance.levelData.unitVolume;

            return(volume >= goalVolume);
        }
Exemple #3
0
        public bool GoalIsHeightMet(GridLevelData.Goal goal)
        {
            if (goal.unitHeightRequire <= 0)
            {
                return(true);
            }

            var heightReq = goal.unitHeightRequire * instance.levelData.sideMeasure;

            return(maxHeight <= heightReq);
        }
Exemple #4
0
    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();
    }