/// <summary> /// Create and register a new attachment point. /// </summary> /// <remarks> /// The attachment point itself is a fairly opaque handle. Its effects are propagated to the client via the /// two handlers associated with it. /// The optional context attachment point provides an optional contextual hint to where in the anchor /// graph to bind the new attachment point. /// See <see cref="IAttachmentPointManager.CreateAttachmentPoint"/>. /// </remarks> /// <param name="frozenPosition">The position in the frozen space at which to start the attachment point</param> /// <param name="context">The optional context into which to create the attachment point (may be null)</param> /// <param name="locationHandler">Delegate to handle WorldLocking system adjustments to position</param> /// <param name="stateHandler">Delegate to handle WorldLocking connectivity changes</param> /// <returns>The new attachment point interface.</returns> public IAttachmentPoint CreateAttachmentPoint(Vector3 frozenPosition, IAttachmentPoint context, AdjustLocationDelegate locationHandler, AdjustStateDelegate stateHandler) { FragmentId fragmentId = GetTargetFragmentId(context); AttachmentPoint attachPoint = new AttachmentPoint(locationHandler, stateHandler); attachPoint.ObjectPosition = frozenPosition; if (fragmentId.IsKnown()) { SetupAttachmentPoint(plugin, attachPoint, context); Fragment fragment = EnsureFragment(fragmentId); Debug.Assert(fragment != null, "Valid fragmentId but no fragment found"); fragment.AddAttachmentPoint(attachPoint); } else { AddPendingAttachmentPoint(attachPoint, context); } return(attachPoint); }
/// <summary> /// Constructor, sets handlers /// </summary> /// <param name="locationHandler">Handler for positional adjustments, may be null.</param> /// <param name="stateHandler">Handler for connectivity adjustments, may be null.</param> public AttachmentPoint(AdjustLocationDelegate locationHandler, AdjustStateDelegate stateHandler) { this.LocationHandler = locationHandler; this.StateHandler = stateHandler; }