Ejemplo n.º 1
0
        private void UpdateHighlightModes()
        {
            bool oldHighlightColors = highlightColors;

            highlightColors = ((Mode & HighlightTypes.Color) != 0);
            if ((oldHighlightColors == false) && (highlightColors == true))
            {
                MyColorTransition = GetComponent <ColorTransition>();
            }

            highlightOutline = ((Mode & HighlightTypes.Outline) != 0);
            if (!highlightOutline)
            {
                if (myOutlineTarget)
                {
                    OutlineTarget.Remove(gameObject);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// removes an outline target component from an object
        /// </summary>
        /// <param name="go">game object from which the outline target will be removed</param>
        /// <param name="destroy">if true, the component will be destroyed, else it will be just disabled</param>
        public static void Remove(GameObject go, bool destroy = false)
        {
            if (go != null)
            {
                OutlineTarget target = go.GetComponent <OutlineTarget>();

                if (target)
                {
                    if (destroy)
                    {
                        UnityEngine.Object.Destroy(target);
                    }
                    else
                    {
                        target.enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// adds outline target to a game object
        /// </summary>
        /// <param name="go">game object to which new outline target will be added</param>
        /// <param name="hidden">if true, the component will not be visible in editor</param>
        /// <returns>new outline target component</returns>
        public static OutlineTarget Add(GameObject go, bool hidden = false)
        {
            OutlineTarget target = null;

            if (go == null)
            {
                return(target);
            }

            target = go.GetComponent <OutlineTarget>();

            if (!target)
            {
                target = go.AddComponent <OutlineTarget>();
                if (hidden)
                {
                    target.hideFlags = HideFlags.HideInInspector;
                }
            }

            target.enabled = true;

            return(target);
        }
Ejemplo n.º 4
0
 private void DeHighlightOutline()
 {
     OutlineTarget.Remove(gameObject);
     StopTransition();
 }
Ejemplo n.º 5
0
 private void HighlightOutline()
 {
     myOutlineTarget = OutlineTarget.Add(gameObject);
     ClampOutlineThicknessCurve();
     StartTransition(highlightColors);
 }
Ejemplo n.º 6
0
 public OutlineTargetListKey(OutlineTarget target, bool useOldMode = false, bool useOldThickness = false)
 {
     Mode      = useOldMode ? target.OldMode : target.Mode;
     Thickness = useOldThickness ? target.OldThickness : target.Thickness;
 }