public Init ( int _depthLevel, float _rotateAmount, float _sizeScalar ) : void | ||
_depthLevel | int | |
_rotateAmount | float | |
_sizeScalar | float | |
Результат | void |
public bool Branch() { if (verbose) { Debug.Log ("Branch() entered"); } if (branched || !readyToBranch) { return false; } branchLoc = GetBranchLoc (); if (verbose) markBranchPoint (); if (depthLevel != 0 && isRoot) { throw new System.Exception ("Cannot branch before calling Init() on TreeSegment"); } if (depthLevel >= maxDepth) { // renderer.material.color = new Color(0, 1f, 0, renderer.material.color.a); //DEVEL return false; } int childDepth = depthLevel + 1; //handle the case where the leave nodes are not branched and don't rotate if (noBranchOnEndNode == true && depthLevel == maxDepth - 1) { if (branch1 == null) { // if no first branch branch1 = Instantiate (this, branchLoc, transform.rotation) as ProceduralTreeSegment; branch1.Init (childDepth, 0, treePiece.endWidthRatio); //branch1.BroadcastMessage ("Initted"); } } else { if (branch1 == null) { // if no first branch branch1 = Instantiate (this, branchLoc, transform.rotation) as ProceduralTreeSegment; branch1.Init (childDepth, Random.Range (minBranchAngle, maxBranchAngle), treePiece.endWidthRatio); //branch1.BroadcastMessage ("Initted"); } if (branch2 == null) { branch2 = Instantiate (this, branchLoc, transform.rotation) as ProceduralTreeSegment; branch2.Init (childDepth, Random.Range (minBranchAngle, maxBranchAngle) * -1f, treePiece.endWidthRatio); //branch2.BroadcastMessage ("Initted"); } } branched = true; // renderer.material.color = new Color(139 / 255f, 100 / 255f, 19 / 255f, renderer.material.color.a); //DEVEL //Debug.Log ("finished branching"); //DEBUG return true; }
public bool Branch() { if (verbose) { Debug.Log("Branch() entered"); } if (branched || !readyToBranch) { return(false); } branchLoc = GetBranchLoc(); if (verbose) { markBranchPoint(); } if (depthLevel != 0 && isRoot) { throw new System.Exception("Cannot branch before calling Init() on TreeSegment"); } if (depthLevel >= maxDepth) { // renderer.material.color = new Color(0, 1f, 0, renderer.material.color.a); //DEVEL return(false); } int childDepth = depthLevel + 1; //handle the case where the leave nodes are not branched and don't rotate if (noBranchOnEndNode == true && depthLevel == maxDepth - 1) { if (branch1 == null) // if no first branch { branch1 = Instantiate(this, branchLoc, transform.rotation) as ProceduralTreeSegment; branch1.Init(childDepth, 0, treePiece.endWidthRatio); //branch1.BroadcastMessage ("Initted"); } } else { if (branch1 == null) // if no first branch { branch1 = Instantiate(this, branchLoc, transform.rotation) as ProceduralTreeSegment; branch1.Init(childDepth, Random.Range(minBranchAngle, maxBranchAngle), treePiece.endWidthRatio); //branch1.BroadcastMessage ("Initted"); } if (branch2 == null) { branch2 = Instantiate(this, branchLoc, transform.rotation) as ProceduralTreeSegment; branch2.Init(childDepth, Random.Range(minBranchAngle, maxBranchAngle) * -1f, treePiece.endWidthRatio); //branch2.BroadcastMessage ("Initted"); } } branched = true; // renderer.material.color = new Color(139 / 255f, 100 / 255f, 19 / 255f, renderer.material.color.a); //DEVEL //Debug.Log ("finished branching"); //DEBUG return(true); }