예제 #1
0
        /// <summary>
        /// Hides our text item if it is displaying.
        /// </summary>
        public void Hide()
        {
            if (TextObject == null)
            {
                return;
            }

            TextFade.SetState(false);
            TextObject.SetActive(false);
        }
예제 #2
0
        /// <summary>
        /// Shows our text item, fading after a specified number of seconds (or stays on indefinitely if 0 seconds)
        /// </summary>
        /// <param name="s">The text to display</param>
        /// <param name="seconds">The duration to hold before fading</param>
        public void ShowMessage(string s, float seconds)
        {
            if (TextObject == null)
            {
                // First time only, initialize the object and components
                InitializeText();
            }

            // Set our actual text
            TextFade.SetText(s);

            // Sets our location on the screen
            DoAlignment();

            // Turns our text item on
            TextFade.SetState(true);
            TextObject.SetActive(true);

            // If specified, sets the fade-out timer
            if (seconds > 0)
            {
                TextFade.FadeOut(seconds, null);
            }
        }