public void UpdateFrequency(TreeData owner)
{
if (this.distributionFrequency < 1)
{
this.distributionFrequency = 1;
}
if (this.parentGroup == null)
{
this.distributionFrequency = 1;
if (this.nodes.Count < 1)
{
owner.AddNode(this, null, false);
}
}
else if ((this.lockFlags == 0) && (this.parentGroup != null))
{
int num = 0;
for (int j = 0; j < this.parentGroup.nodes.Count; j++)
{
int num3 = Mathf.RoundToInt(this.distributionFrequency * this.parentGroup.nodes[j].GetScale());
if (num3 < 1)
{
num3 = 1;
}
for (int k = 0; k < num3; k++)
{
if (num < this.nodes.Count)
{
owner.SetNodeParent(this.nodes[num], this.parentGroup.nodes[j]);
}
else
{
owner.AddNode(this, this.parentGroup.nodes[j], false);
}
num++;
}
}
if (num < this.nodes.Count)
{
List<TreeNode> list = new List<TreeNode>();
for (int m = num; m < this.nodes.Count; m++)
{
list.Add(this.nodes[m]);
}
for (int n = 0; n < list.Count; n++)
{
owner.DeleteNode(list[n], false);
}
}
this.UpdateSeed();
this.UpdateDistribution(true, false);
}
for (int i = 0; i < this.childGroups.Count; i++)
{
this.childGroups[i].UpdateFrequency(owner);
}
}