Пример #1
0
        public static TransparencyInterface getTransparencyObject(String name)
        {
            TransparencyInterface transInter = null;

            transparencyInterfaces.TryGetValue(name, out transInter);
            return(transInter);
        }
        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);
        }
 protected override void link()
 {
     parentInterface = TransparencyController.getTransparencyObject(parentInterfaceName);
     if (parentInterface == null)
     {
         blacklist("Cannot find parent interface \"{0}\".", parentInterfaceName);
     }
     parentInterface.addSubInterface(this);
 }
 protected override void link()
 {
     base.link();
     watchingInterface = TransparencyController.getTransparencyObject(watchingInterfaceName);
     if (watchingInterface == null)
     {
         blacklist("Cannot find watching interface \"{0}\".", watchingInterfaceName);
     }
 }
Пример #5
0
        internal void instantlyApplyBlended(List <TransparencyInterface> unvisitedInterfaces, float endAlphaValue, float percent)
        {
            TransparencyInterface obj = TransparencyController.getTransparencyObject(transparencyObject);

            if (obj != null)
            {
                obj.CurrentAlpha = NumberFunctions.lerp(alphaValue, endAlphaValue, percent);
                unvisitedInterfaces.Remove(obj);
            }
        }
Пример #6
0
        public void instantlyApplyBlendPercent(List <TransparencyInterface> unvisitedInterfaces, float percent)
        {
            TransparencyInterface obj = TransparencyController.getTransparencyObject(transparencyObject);

            if (obj != null)
            {
                obj.CurrentAlpha += (alphaValue - obj.CurrentAlpha) * percent;
                unvisitedInterfaces.Remove(obj);
            }
        }
Пример #7
0
        public void instantlyApply(List <TransparencyInterface> unvisitedInterfaces)
        {
            TransparencyInterface obj = TransparencyController.getTransparencyObject(transparencyObject);

            if (obj != null)
            {
                obj.CurrentAlpha = alphaValue;
                unvisitedInterfaces.Remove(obj);
            }
        }
Пример #8
0
        public void timedApply(float time, List <TransparencyInterface> unvisitedInterfaces, EasingFunction easingFunction)
        {
            TransparencyInterface obj = TransparencyController.getTransparencyObject(transparencyObject);

            if (obj != null)
            {
                obj.timedBlend(alphaValue, time, easingFunction);
                unvisitedInterfaces.Remove(obj);
            }
        }
 public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage)
 {
     transparencyInterface = owner.getElement(transparencyInterfaceName) as TransparencyInterface;
     if (transparencyInterface == null)
     {
         errorMessage = String.Format("Could not find TransparencyInterface named {0}", transparencyInterfaceName);
         return(false);
     }
     parentAnatomy._setTransparencyCommand(this);
     return(true);
 }
Пример #10
0
        protected override void link()
        {
            SimObject cullSimObject = Owner.getOtherSimObject(cullSimObjectName);

            if (cullSimObject == null)
            {
                blacklist("Could not find cull SimObject {0}.", cullSimObjectName);
            }

            cullInterface = cullSimObject.getElement(cullTransparencyInterfaceName) as TransparencyInterface;
            if (cullInterface == null)
            {
                blacklist("Could not find cull transparency interface {0} in SimObject {1}.", cullTransparencyInterfaceName, cullSimObject);
            }
            cullInterface.setTransparencyOverrider(this);
        }
Пример #11
0
 internal static void addTransparencyObject(TransparencyInterface alphaObject)
 {
     try
     {
         transparencyInterfaces.Add(alphaObject.ObjectName, alphaObject);
         //Add all the needed transparency states.
         for (int i = 1; i < transparencyStateNames.Count; ++i)
         {
             alphaObject.createTransparencyState();
         }
         alphaObject.ActiveTransparencyState = TransparencyStateIndex;
     }
     catch (ArgumentException)
     {
         throw new TransparencyException(String.Format("A Transparency Object named '{0}' from Sim Object '{1}' already exists. The Transparency Object that was stored for this name is '{2}'.", alphaObject.ObjectName, alphaObject.Owner.Name, transparencyInterfaces[alphaObject.ObjectName].Owner.Name));
     }
 }
Пример #12
0
        protected override void constructed()
        {
            sceneNodeElement = Owner.getElement(sceneNodeName) as SceneNodeElement;
            if (sceneNodeElement == null)
            {
                blacklist("Could not find SceneNodeElement {0}.", sceneNodeName);
            }
            entity = sceneNodeElement.getNodeObject(entityName) as Entity;
            if (entity == null)
            {
                blacklist("Could not find Entity {0}.", entityName);
            }

            actorElement = Owner.getElement(actorName) as RigidBody;
            if (actorElement == null)
            {
                blacklist("Could not find Actor {0}.", actorName);
            }
            SleepyActorRepository.addSleeper(actorElement);

            joint = Owner.getElement(jointName) as Generic6DofConstraintElement;
            if (joint == null)
            {
                blacklist("Could not find Joint {0}.", jointName);
            }
            startingLocation = joint.getFrameOffsetOriginA();
            startingRotation = joint.getFrameOffsetBasisA();

            transparency = Owner.getElement(transparencyInterface) as TransparencyInterface;
            if (transparency == null)
            {
                blacklist("Could not find TransparencyInterface {0}", transparencyInterface);
            }
            TeethController.addTooth(Owner.Name, this);
            HighlightColor = Color.White;
        }
Пример #13
0
 internal static void removeTransparencyObject(TransparencyInterface alphaObject)
 {
     transparencyInterfaces.Remove(alphaObject.ObjectName);
 }
Пример #14
0
 public LayerEntry(TransparencyInterface trans, float overrideAlpha)
 {
     this.transparencyObject = trans.ObjectName;
     alphaValue = overrideAlpha;
 }
Пример #15
0
 public LayerEntry(TransparencyInterface trans)
 {
     this.transparencyObject = trans.ObjectName;
     alphaValue = trans.CurrentAlpha;
 }
 /// <summary>
 /// This function should only be called from the TransparencyInterface.
 /// </summary>
 internal void _disconnectFromInterface()
 {
     parentInterface = null;
 }