// Use this for initialization void Start() { pts = GetComponent<ProceduralTreeSegment>(); if (pts == null) { throw new System.Exception("The GameObject needs a ProceduralTreeSeqment component for this script to work"); } }
// Use this for initialization void Start() { pts = GetComponent <ProceduralTreeSegment>(); if (pts == null) { throw new System.Exception("The GameObject needs a ProceduralTreeSeqment component for this script to work"); } }
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; }
// Use this for initialization void Start() { origScale = transform.localScale; transform.localScale = Vector3.zero; pts = gameObject.GetComponent<ProceduralTreeSegment>(); if (pts == null) { throw new System.Exception("A ProceduralTreeSegment script must be attached to the GameObject for this script to work"); } newAppearSpeed = appearSpeed * Random.Range(1.0f, 1.0f + maxRandGrowthRatio); }
// Use this for initialization void Start() { ts = gameObject.GetComponent<ProceduralTreeSegment>(); if (ts == null) { throw new System.Exception("This GameObject needs a ProceduralTreeSegment"); } if (gameObject.GetComponent<Rigidbody>() == null) { throw new System.Exception("This GameObject needs a rigid body to trigger branching on collision"); } }
// Use this for initialization void Start() { origScale = transform.localScale; transform.localScale = Vector3.zero; pts = gameObject.GetComponent <ProceduralTreeSegment>(); if (pts == null) { throw new System.Exception("A ProceduralTreeSegment script must be attached to the GameObject for this script to work"); } newAppearSpeed = appearSpeed * Random.Range(1.0f, 1.0f + maxRandGrowthRatio); }
// Use this for initialization void Start() { ts = gameObject.GetComponent <ProceduralTreeSegment>(); if (ts == null) { throw new System.Exception("This GameObject needs a ProceduralTreeSegment"); } if (gameObject.GetComponent <Rigidbody>() == null) { throw new System.Exception("This GameObject needs a rigid body to trigger branching on collision"); } }
private void Initted() { ProceduralTreeSegment pts = GetComponent <ProceduralTreeSegment>(); if (pts == null) { throw new System.Exception("A ProceduralTreeSegment script must be attached for this script to work"); } if (pts.DepthLevel == pts.MaxDepth) { SetTreeSegTexture(); } }
// Use this for initialization void Start() { ProceduralTreeSegment pts = GetComponent <ProceduralTreeSegment>(); if (pts == null) { throw new System.Exception("A ProceduralTreeSegment script must be attached for this script to work"); } if (pts.DepthLevel == pts.MaxDepth) { transform.renderer.material.color = leafColor; } }
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); }
void Start() { pts = gameObject.GetComponent<ProceduralTreeSegment>(); }
void Start() { pts = gameObject.GetComponent <ProceduralTreeSegment>(); }