![]() | ILinkTargetlinkSource Property |
Namespace: KASAPIv2
ILinkSource linkSource { get; set; }
Setting of this property changes the target state:
Assigning the same value to this property doesn't trigger a state change event.
Note, that not any state transition is possible. If the transition is invalid then an exception is thrown.
It's discouraged to assign this property from a code other than an implementation of ILinkSource.
// Returns the linked part of the target, if any. It assumes there is exactly one target module // on the part. public static Part FindSourceFromTarget(Part tgtPart) { var source = tgtPart.FindModulesImplementing<ILinkTarget>() .FirstOrDefault(s => s.linkSource != null); if (source == null) { Debug.Log("Target is not connected"); return null; } return source.linkSource.part; }