31 lines
560 B
C#
31 lines
560 B
C#
namespace Mtree
|
|
{
|
|
public struct GrowthInformation
|
|
{
|
|
public float remainingGrowth;
|
|
|
|
public float growthGoal;
|
|
|
|
public float initialRadius;
|
|
|
|
public bool canBeSplit;
|
|
|
|
public GrowthInformation(float goal = 0f, float remaining = 0f, float radius = 1f)
|
|
{
|
|
remainingGrowth = remaining;
|
|
growthGoal = goal;
|
|
initialRadius = radius;
|
|
canBeSplit = true;
|
|
}
|
|
|
|
public float GrowthPercentage(float additionalLength = 0f)
|
|
{
|
|
if (growthGoal == 0f)
|
|
{
|
|
return 0f;
|
|
}
|
|
return 1f - (remainingGrowth - additionalLength) / growthGoal;
|
|
}
|
|
}
|
|
}
|