Beispiel #1
0
        void CellAnimate(FADER_STYLE style, int cellIndex, Color color, float duration)
        {
            if (cellIndex < 0 || cellIndex >= cells.Length)
            {
                return;
            }
            if (cellIndex == _cellHighlightedIndex)
            {
                cells [cellIndex].isFading = true;
                HideCellHighlight();
            }
            Renderer renderer = null;

            gridSurfaces.TryGetValue(cellIndex, out renderer);
            Color initialColor = Misc.ColorClear;

            if (renderer == null)
            {
                renderer = SetCellTemporaryColor(cellIndex, initialColor);
            }
            else
            {
                if (renderer.enabled)
                {
                    initialColor = renderer.sharedMaterial.color;
                }
                else
                {
                    renderer.enabled = true;
                }
            }
            SurfaceFader.Animate(style, cells [cellIndex], renderer, initialColor, color, duration);
        }
Beispiel #2
0
        public static void Animate(FADER_STYLE style, IFader fadeEntity, Renderer renderer, Color initialColor, Color color, float duration)
        {
            SurfaceFader fader = renderer.GetComponent <SurfaceFader> ();

            if (fader != null)
            {
                DestroyImmediate(fader);
            }
            fader              = renderer.gameObject.AddComponent <SurfaceFader> ();
            fader.duration     = duration + 0.0001f;
            fader.color        = color;
            fader.style        = style;
            fader._renderer    = renderer;
            fader.fadeEntity   = fadeEntity;
            fader.initialColor = initialColor;
        }
Beispiel #3
0
        public static void Animate(FADER_STYLE style, IFader fadeEntity, Renderer renderer, Color initialColor, Color color, float duration)
        {
            SurfaceFader fader = renderer.GetComponent <SurfaceFader> ();

            if (fader == null)
            {
                fader = renderer.gameObject.AddComponent <SurfaceFader>();
                fader.fadeMaterial           = Instantiate(renderer.sharedMaterial);
                fader.fadeMaterial.hideFlags = HideFlags.DontSave;
                renderer.sharedMaterial      = fader.fadeMaterial;
            }
            fader.duration           = duration + 0.0001f;
            fader.color              = color;
            fader.style              = style;
            fader._renderer          = renderer;
            fader.fadeEntity         = fadeEntity;
            fadeEntity.isFading      = true;
            fader.initialColor       = initialColor;
            fader.map                = WMSK.GetInstance(renderer.transform);
            fader.highlightFadeStart = fader.map.time;
            fader.Update();
        }