// Token: 0x06002659 RID: 9817 RVA: 0x000E15F4 File Offset: 0x000DF9F4 public Road(byte newMaterial, ushort newRoadIndex, bool newLoop, List <RoadJoint> newJoints) { this.material = newMaterial; this.roadIndex = newRoadIndex; this._road = new GameObject().transform; this.road.name = "Road"; this.road.parent = LevelRoads.models; this.road.tag = "Environment"; this.road.gameObject.layer = LayerMasks.ENVIRONMENT; this._isLoop = newLoop; this._joints = newJoints; this.samples = new List <RoadSample>(); this.trackSamples = new List <TrackSample>(); if (Level.isEditor) { this.line = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load("Edit/Road"))).transform; this.line.name = "Line"; this.line.parent = LevelRoads.models; this._paths = new List <RoadPath>(); this.lineRenderer = this.line.GetComponent <LineRenderer>(); for (int i = 0; i < this.joints.Count; i++) { Transform transform = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load("Edit/Path"))).transform; transform.name = "Path_" + i; transform.parent = this.line; RoadPath item = new RoadPath(transform); this.paths.Add(item); } if (LevelGround.terrain != null) { this.updatePoints(); } } }
public Transform addPoint(Transform origin, Vector3 point) { RoadJoint roadJoint = new RoadJoint(point); if (origin == null || origin == this.paths[this.paths.Count - 1].vertex) { if (this.joints.Count > 0) { roadJoint.setTangent(0, (this.joints[this.joints.Count - 1].vertex - point).normalized * 2.5f); } this.joints.Add(roadJoint); Transform transform = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load("Edit/Path"))).transform; transform.name = "Path_" + (this.joints.Count - 1); transform.parent = this.line; RoadPath roadPath = new RoadPath(transform); this.paths.Add(roadPath); this.updatePoints(); return(roadPath.vertex); } if (origin == this.paths[0].vertex) { for (int i = 0; i < this.joints.Count; i++) { this.paths[i].vertex.name = "Path_" + (i + 1); } if (this.joints.Count > 0) { roadJoint.setTangent(1, (this.joints[0].vertex - point).normalized * 2.5f); } this.joints.Insert(0, roadJoint); Transform transform2 = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load("Edit/Path"))).transform; transform2.name = "Path_0"; transform2.parent = this.line; RoadPath roadPath2 = new RoadPath(transform2); this.paths.Insert(0, roadPath2); this.updatePoints(); return(roadPath2.vertex); } return(null); }