public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage) { SimObject targetSimObject = owner.getOtherSimObject(targetSimObjectName); if (targetSimObject == null) { errorMessage = String.Format("Could not find target SimObject {0}", targetSimObjectName); return(false); } transparencyInterface = targetSimObject.getElement(targetTransparencyInterfaceName) as TransparencyInterface; if (transparencyInterface == null) { errorMessage = String.Format("Could not find target TransparencyInterface '{0}' in '{1}'", targetTransparencyInterfaceName, targetSimObject.Name); return(false); } foreach (AnatomyCommand command in parentAnatomy.Commands) { if (command.UIText == TransparencyAnatomyCommand.UI_TEXT) { transparencyAnatomyCommand = (TransparencyAnatomyCommand)command; break; } } if (transparencyAnatomyCommand == null) { errorMessage = String.Format("Can not have a TransparencySectionAnatomyCommand on AnatomyIdentifier {0} because it has no TransparencyAnatomyCommand.", parentAnatomy.AnatomicalName); return(false); } transparencyAnatomyCommand.NumericValueChanged += transparencyAnatomyCommand_NumericValueChanged; transparencyAnatomyCommand.SmoothBlendApplied += transparencyAnatomyCommand_SmoothBlendApplied; return(true); }
internal void _setTransparencyCommand(TransparencyAnatomyCommand command) { this.transparencyCommand = command; }