Exemplo n.º 1
0
    /*List<TrackSection> FindConnectedTrackSections(TrackSection start)
     * {
     *  List<TrackSection> list = new List<TrackSection>();
     *  list.Add(start);
     *  TrackSection current = start;
     *  while(current.Next != null && !list.Contains(current.Next))
     *  {
     *      current = current.Next;
     *      list.Add(current);
     *  }
     *  return list;
     * }*/

    /*public void OnDrawGizmos()
     * {
     *  foreach(TrackSection section in trackSections)
     *  {
     *      Vector3 start = section.position.Vector3();
     *      Vector3 end = section.GetPositionOnTrack(section.length).Vector3();
     *      Gizmos.DrawLine(start, end);
     *      Gizmos.DrawCube(start, Vector3.one);
     *      if(section.Next == null)
     *      {
     *          Gizmos.DrawCube(end, Vector3.one);
     *      }
     *  }
     * }*/

    /// <summary>
    /// TODO: Create wrapper for junctions
    /// </summary>
    /// <param name="junction"></param>
    /// <returns></returns>
    GameObject CreateJunctionObject(TrackJunction junction)
    {
        Junction go = GameObject.Instantiate(junctionPrefab);

        go.Init(junction);
        go.transform.SetParent(transform);

        return(go.gameObject);
    }