public static DeadEnd CreateDeadEnd(Cross _cross, int _index)
        {
            GameObject obj = new GameObject("DeadEnd");
            DeadEnd    de  = obj.AddComponent <DeadEnd>();

            OrientedPoint op = _cross.m_OPs[_index];

            de.Init(_cross, _index, op);
            obj.transform.parent = _cross.transform;
            return(de);
        }
Ejemplo n.º 2
0
        public DeadEnd Init(Cross _cross, int _index, OrientedPoint _op)
        {
            base.Init(false);
            ID      = -2;
            m_Shape = new DeadEndShape();
            SetStartConnection(new Connection(null, this, true));

            Vector3 start    = _op.Position + (_op.Rotation * Vector3.right) * 0.5f;
            Vector3 tangent1 = start + _op.Rotation * Vector3.forward * 0.8f;
            Vector3 end      = _op.Position - (_op.Rotation * Vector3.right) * 0.5f;
            Vector3 tangent2 = end + _op.Rotation * Vector3.forward * 0.8f;

            m_Spline = new Spline(
                start, tangent1, tangent2, end, 10, this
                );

            m_MeshFilter            = gameObject.AddComponent <MeshFilter>();
            m_MeshRenderer          = gameObject.AddComponent <MeshRenderer>();
            m_MeshRenderer.material = StreetComponentManager.Instance.DeadEndMat;
            MeshGenerator.Extrude(this);
            Connection.Combine(GetStartConnection(), _cross.m_Connections[_index]);

            return(this);
        }
 public static void AddCross(Cross _c)
 {
     StreetComponentID_Dic.Add(_c.ID, _c);
 }