Ejemplo n.º 1
0
        public SplitTrack(string id, Vector3 initialDown, SubTrack[] subTracks)
        {
            SubTracks = subTracks;
            InitialDown = initialDown;
            Id = id;

            foreach (SubTrack subTrack in subTracks)
            {
                subTrack.OnAttachToSplitTrack(this);
            }
        }
Ejemplo n.º 2
0
        private void BuildSplitTrack(GroupBranch groupBranch, SubTrack track)
        {
            SplitBoundsBranch splitBranch = groupBranch.SplitBoundsBranchContaining(track.SplittedRegion);

            GameObject gameObj = new GameObject(track.Id);
            TrackExtruder trackExtruder = new TrackExtruder(TrackBuilderConfiguration.DefaultConfig);

            foreach (SubTrackGroup subTrackGroup in track.TrackGroups)
            {
                BezierSpline spline = subTrackGroup.Spline;
                Mesh trackMesh = trackExtruder.ExtrudeAlong(spline, track.SplitTrack.InitialDown);
                GameObject childTrack = GameObjectUtils.AsChildOf(gameObj.transform, new Vector3(), Object.Instantiate(groupBranch.Level.Prefabs.TrackPrefab));
                childTrack.name = subTrackGroup.Id;
                childTrack.GetComponent<MeshFilter>().mesh = trackMesh;
            }

            splitBranch.TracksLeaf.Attach(gameObj);
        }
Ejemplo n.º 3
0
 public void OnAttachToSubTrack(SubTrack subTrack)
 {
     SubTrack = subTrack;
 }
Ejemplo n.º 4
0
 private void AssertSubtrackContainsNodes(SubTrack subtrack, int groupIdx, Vector3[] nodePositions, bool allowSubset = false)
 {
     if(!allowSubset){
         Assert.That(subtrack.trackGroups[groupIdx].NumTrackNodes, Is.EqualTo(nodePositions.Length));
     }
     Assert.That(nodePositions, Is.SubsetOf(subtrack.trackGroups[groupIdx].nodes.Select(t => t.position)));
 }