Ejemplo n.º 1
0
    public float GetRandomWallLength(float otherWallLength)
    {
        if (WallRatioMax == 1)
        {
            return(otherWallLength);
        }
        float ratioEnforcedMin = otherWallLength / WallRatioMax;
        float ratioEnforcedMax = otherWallLength * WallRatioMax;

        if (wallLengthMultiple > 0)
        {
            ratioEnforcedMin = GS.CeilTo(ratioEnforcedMin, wallLengthMultiple);
            ratioEnforcedMax = GS.FloorTo(ratioEnforcedMax, wallLengthMultiple);
        }
        float actualMin = Mathf.Max(ratioEnforcedMin, WallLengthMin);
        float actualMax = Mathf.Min(ratioEnforcedMax, WallLengthMax);

        return(GS.RoundTo(Random.Range(actualMin, actualMax), wallLengthMultiple));
    }