/// <summary> /// Create a Dead End and Combine the Street with it /// </summary> /// <param name="_street">The Street the Dead End is Connected to</param> /// <param name="_isStart">Is it the Start of the Street</param> /// <returns>The new Dead End</returns> public static DeadEnd CreateDeadEnd(Street _street, bool _isStart) { GameObject obj = new GameObject("DeadEnd"); DeadEnd de = obj.AddComponent <DeadEnd>(); OrientedPoint op; if (_isStart) { op = _street.m_Spline.GetFirstOrientedPoint(); } else { op = _street.m_Spline.GetLastOrientedPoint(); } de.Init(_street, _isStart, op); if (_isStart) { Connection.Combine(_street.GetStartConnection(), de.GetStartConnection()); } else { Connection.Combine(_street.m_EndConnection, de.GetStartConnection()); } return(de); }
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); }
/// <summary> /// Decombine and Destroy the Dead End /// </summary> /// <param name="_de">The Dead End to Destroy</param> public static void DestroyDeadEnd(DeadEnd _de) { Connection.DeCombine(_de.GetStartConnection(), _de.GetStartConnection().m_OtherConnection); Destroy(_de.gameObject); }