TreeEditor.TreeGroup.UpdateSeed C# (CSharp) Method

UpdateSeed() public method

public UpdateSeed ( ) : void
return void
        public void UpdateSeed()
        {
            TreeGroup parentGroup = this;
            while (parentGroup.parentGroup != null)
            {
                parentGroup = parentGroup.parentGroup;
            }
            int seed = parentGroup.seed;
            this._internalSeed = seed + ((int) (this.seed * 1.21f));
            for (int i = 0; i < this.nodes.Count; i++)
            {
                this.nodes[i].seed = (seed + this._internalSeed) + ((int) (i * 3.7482f));
            }
            for (int j = 0; j < this.childGroups.Count; j++)
            {
                this.childGroups[j].UpdateSeed();
            }
        }

Usage Example

Ejemplo n.º 1
0
        public void UpdateSeed(int id)
        {
            TreeGroup group = this.GetGroup(id);

            if (group == null)
            {
                return;
            }
            int seed = UnityEngine.Random.seed;

            this.ClearReferences();
            this.ValidateReferences();
            group.UpdateSeed();
            group.UpdateDistribution(true, true);
            this.ClearReferences();
            UnityEngine.Random.seed = seed;
        }