/// <summary> /// Add an attachment to this node. /// </summary> /// <param name="attachment">Attachment to add.</param> /// <returns>True if added, false if null or already present.</returns> public bool Add(CableAttachment attachment) { if (attachment == null || m_attachments.Contains(attachment)) { return(false); } m_attachments.Add(attachment); return(true); }
/// <summary> /// Creates and adds an attachment to this cable node. /// </summary> /// <param name="attachmentType">Attachment type.</param> /// <param name="parent">Parent game object - world if null.</param> /// <param name="localPosition">Position in parent frame. If parent is null this is the position in world frame.</param> /// <param name="localRotation">Rotation in parent frame. If parent is null this is the rotation in world frame.</param> /// <returns>Create attachment if added - otherwise null.</returns> public CableAttachment Add(CableAttachment.AttachmentType attachmentType, GameObject parent = null, Vector3 localPosition = default(Vector3), Quaternion localRotation = default(Quaternion)) { var attachment = CableAttachment.Create(attachmentType, parent, localPosition, localRotation); if (!Add(attachment)) { return(null); } return(attachment); }