public void CreateBranchSegment(Vector3 n_startPosTemp, float n_angleTemp, Vector2 n_scaleTemp, int n_depthTemp, GameObject n_thisOBJ) { int Tempint; Tempint = Random.Range(1, 4); Quaternion rot = Quaternion.Euler(0, 0, n_angleTemp); Vector3 topPos = n_startPosTemp + (rot * (TreeParms.trunkTopOffset * (n_scaleTemp.y))); //THE 4 TREE RULES OF ISENGARD float angleLeft = CustomExtensions.ClampAngle(n_angleTemp - TreeParms.branchAngle + Random.Range(-TreeParms.angleRandom, TreeParms.angleRandom)); float angleRight = CustomExtensions.ClampAngle(n_angleTemp + TreeParms.branchAngle + Random.Range(-TreeParms.angleRandom, TreeParms.angleRandom)); switch (Tempint) { case 1: //Create Left Side TreeParms.CreateSegment(topPos, n_startPosTemp, angleLeft, new Vector2(n_scaleTemp.x, n_scaleTemp.y - (TreeParms.scaleChange + Random.Range(0, TreeParms.scaleRandom))), n_depthTemp + 1, "Main_Left_Branch", n_thisOBJ, Tree_Master.treeMasterGameOBJ, Tree_Master.trunkPrefab, Tree_Segment_Script.TreeSegmentType.BRANCH); break; case 2: //Create Right Side TreeParms.CreateSegment(topPos, n_startPosTemp, angleRight, new Vector2(n_scaleTemp.x, n_scaleTemp.y - (TreeParms.scaleChange + Random.Range(0, TreeParms.scaleRandom))), n_depthTemp + 1, "Main_Right_Branch", n_thisOBJ, Tree_Master.treeMasterGameOBJ, Tree_Master.trunkPrefab, Tree_Segment_Script.TreeSegmentType.BRANCH); break; case 3: //Create Left Side TreeParms.CreateSegment(topPos, n_startPosTemp, angleLeft, new Vector2(n_scaleTemp.x, n_scaleTemp.y - (TreeParms.scaleChange + Random.Range(0, TreeParms.scaleRandom))), n_depthTemp + 1, "Twin_Left_Branch", n_thisOBJ, Tree_Master.treeMasterGameOBJ, Tree_Master.trunkPrefab, Tree_Segment_Script.TreeSegmentType.BRANCH); //Create Right Side TreeParms.CreateSegment(topPos, n_startPosTemp, angleRight, new Vector2(n_scaleTemp.x, n_scaleTemp.y - (TreeParms.scaleChange + Random.Range(0, TreeParms.scaleRandom))), n_depthTemp + 1, "Twin_Right_Branch", n_thisOBJ, Tree_Master.treeMasterGameOBJ, Tree_Master.trunkPrefab, Tree_Segment_Script.TreeSegmentType.BRANCH); break; } }
public void CreateTrunkSegment(Vector3 n_startPosTemp, float n_angleTemp, Vector2 n_scaleTemp, int n_depthTemp, float n_inputangle, GameObject n_thisOBJ) { Quaternion rot = Quaternion.Euler(0, 0, n_angleTemp); Vector3 topPos = n_startPosTemp + (rot * (TreeParms.trunkTopOffset * (n_scaleTemp.y))); TreeParms.CreateSegment(topPos, n_startPosTemp, n_angleTemp + n_inputangle, new Vector2(n_scaleTemp.x, n_scaleTemp.y - (TreeParms.scaleChange + Random.Range(0, TreeParms.scaleRandom))), n_depthTemp + 1, "Trunk_Segment" + n_depthTemp, n_thisOBJ, Tree_Master.treeMasterGameOBJ, Tree_Master.trunkPrefab, Tree_Segment_Script.TreeSegmentType.TRUNK); }