private void Update()
		{
			// show fadeout when game is running or has ended
			if (MainBase.Instance.state == GameState.Running || MainBase.Instance.state == GameState.Ended)
			{
				if (_fadeInTimer != null)
				{
					_fadeInTimer.Update();
					ApplyFadeIn();

					if (_fadeInTimer.hasEnded)
					{
						SetMaterialColor(Color.white);
						_fadeInTimer = null;
					}
				}
				else if (_fadeOutTimer != null)
				{
					_fadeOutTimer.Update();
					ApplyFadeOut();

					if (_fadeOutTimer.hasEnded)
					{
						SetMaterialColor(Color.white.WithAlpha(0));
						_fadeOutTimer = null;
					}
				}
			}
		}
		// ================================================================================
		//  unity methods
		// --------------------------------------------------------------------------------

		public void Awake()
		{
			_timer = new FadingTimer(0.4f, displayDuration, 0.4f);
			_timer.Stop();

			if (_text == null || _text.Length == 0)
			{
				_text = GetComponentsInChildren<Text>();
			}

			if (_text == null || _text.Length == 0)
			{
				// the MessengerText Object will be inside the MainCanvas
				var messengerObject = GameObject.Find("MessengerText") as GameObject;
				if (messengerObject != null)
					_text = messengerObject.GetComponentsInChildren<Text>();
			}

			if (_text != null)
			{
				for (int i = 0; i < _text.Length; i++)
				{
					_text[i].enabled = false;
				}
			}
		}
Esempio n. 3
0
        private void Update()
        {
            // show fadeout when game is running or has ended
            if (MainBase.Instance.state == GameState.Running || MainBase.Instance.state == GameState.Ended)
            {
                if (_fadeInTimer != null)
                {
                    _fadeInTimer.Update();
                    ApplyFadeIn();

                    if (_fadeInTimer.hasEnded)
                    {
                        SetMaterialColor(Color.white);
                        _fadeInTimer = null;
                    }
                }
                else if (_fadeOutTimer != null)
                {
                    _fadeOutTimer.Update();
                    ApplyFadeOut();

                    if (_fadeOutTimer.hasEnded)
                    {
                        SetMaterialColor(Color.white.WithAlpha(0));
                        _fadeOutTimer = null;
                    }
                }
            }
        }
Esempio n. 4
0
 public void FadeOut()
 {
     if (_fadeOutTimer == null)
     {
         _fadeOutTimer = new FadingTimer(0, Actor.TIME_UNTIL_DESTRUCTION, 2.0f);
     }
 }
        // ================================================================================
        //  unity methods
        // --------------------------------------------------------------------------------

        public void Awake()
        {
            _timer = new FadingTimer(0.4f, displayDuration, 0.4f);
            _timer.Stop();

            if (_text == null || _text.Length == 0)
            {
                _text = GetComponentsInChildren <Text>();
            }

            if (_text == null || _text.Length == 0)
            {
                // the MessengerText Object will be inside the MainCanvas
                var messengerObject = GameObject.Find("MessengerText") as GameObject;
                if (messengerObject != null)
                {
                    _text = messengerObject.GetComponentsInChildren <Text>();
                }
            }

            if (_text != null)
            {
                for (int i = 0; i < _text.Length; i++)
                {
                    _text[i].enabled = false;
                }
            }
        }
Esempio n. 6
0
 public void FadeIn(float time = 1f)
 {
     ClearFading();
     SetMaterialColor(Color.white.WithAlpha(0));
     _fadeInTimer = new FadingTimer(time, time);
     ApplyFadeIn();
 }
Esempio n. 7
0
 public void FadeOutAfterDeath()
 {
     if (_fadeOutTimer == null)
     {
         ClearFading();
         _fadeOutTimer = new FadingTimer(0, Actor2D.TIME_UNTIL_DESTRUCTION, 2.0f);
     }
 }
Esempio n. 8
0
 public void Reset()
 {
     if (_isInitialized)
     {
         if (_animator != null)
         {
             SetAnimation(AvatarAnimation.idle);
         }
         _currentAnimation = AvatarAnimation.idle;
         _fadeOutTimer     = null;
         SetMaterialColor(new Color(1.0f, 1.0f, 1.0f, 1.0f));
     }
 }
Esempio n. 9
0
        void Update()
        {
            // TODO: had to comment this because of main character having no walk animation when steered by Sequence
            //if (_animator != null)
            //{
            //	if (BaseGameController.Instance.state == GameState.Running)
            //	{
            //		_animator.speed = 1.0f;
            //	}
            //	else
            //	{
            //		_animator.speed = 0f;
            //	}
            //}

            // show fadeout when game is running or has ended
            if (BaseGameController.Instance.state == GameState.Running || BaseGameController.Instance.state == GameState.Ended)
            {
                if (_fadeInTimer != null)
                {
                    _fadeInTimer.Update();
                    ApplyFadeIn();

                    if (_fadeInTimer.hasEnded)
                    {
                        SetMaterialColor(new Color(1.0f, 1.0f, 1.0f, 1f));
                        _fadeInTimer = null;
                    }
                }
                else if (_fadeOutTimer != null)
                {
                    _fadeOutTimer.Update();
                    ApplyFadeOut();

                    if (_fadeOutTimer.hasEnded)
                    {
                        SetMaterialColor(new Color(1.0f, 1.0f, 1.0f, 0f));
                        _fadeOutTimer = null;
                    }
                }
            }
        }
Esempio n. 10
0
        void Update()
        {
            if (_animator != null)
            {
                if (BaseGameController.Instance.state == GameState.Running)
                {
                    _animator.speed = 1.0f;
                }
                else
                {
                    _animator.speed = 0f;
                }
            }

            // show fadeout when game is running or has ended
            if (BaseGameController.Instance.state == GameState.Running || BaseGameController.Instance.state == GameState.Ended)
            {
                if (_fadeInTimer != null)
                {
                    _fadeInTimer.Update();
                    ApplyFadeIn();

                    if (_fadeInTimer.hasEnded)
                    {
                        SetMaterialColor(new Color(1.0f, 1.0f, 1.0f, 1f));
                        _fadeInTimer = null;
                    }
                }
                else if (_fadeOutTimer != null)
                {
                    _fadeOutTimer.Update();
                    ApplyFadeOut();

                    if (_fadeOutTimer.hasEnded)
                    {
                        SetMaterialColor(new Color(1.0f, 1.0f, 1.0f, 0f));
                    }
                }
            }
        }
Esempio n. 11
0
 public void FadeOut(float time = 1f)
 {
     ClearFading();
     _fadeOutTimer = new FadingTimer(0, time, time);
     ApplyFadeOut();
 }
Esempio n. 12
0
 public void FadeOutFast(float time)
 {
     _fadeOutTimer = new FadingTimer(0f, time, time);
 }
		public void FadeOutAfterDeath()
		{
			if (_fadeOutTimer == null)
			{
				ClearFading();
				_fadeOutTimer = new FadingTimer(0, Actor2D.TIME_UNTIL_DESTRUCTION, 2.0f);
			}
		}
Esempio n. 14
0
 public void FadeIn()
 {
     SetMaterialColor(new Color(1.0f, 1.0f, 1.0f, 0f));
     _fadeInTimer = new FadingTimer(1f, 1f);
 }
		public void Reset()
		{
			if (_isInitialized)
			{
				if (_animator != null)
					SetAnimation(AvatarAnimation.idle);
				_currentAnimation = AvatarAnimation.idle;
				_fadeOutTimer = null;
				SetMaterialColor(Color.white);
			}
		}
Esempio n. 16
0
        // ================================================================================
        //  private methods
        // --------------------------------------------------------------------------------

        private void ClearFading()
        {
            _fadeInTimer  = null;
            _fadeOutTimer = null;
        }
		// ================================================================================
		//  private methods
		// --------------------------------------------------------------------------------

		private void ClearFading()
		{
			_fadeInTimer = null;
			_fadeOutTimer = null;
		}
		public void FadeOut(float time = 1f)
		{
			ClearFading();
			_fadeOutTimer = new FadingTimer(0, time, time);
			ApplyFadeOut();
		}
		void StartNewTimer()
		{
			_timer = new FadingTimer(intervalMin * 0.2f, Random.Range(intervalMin, intervalMax), intervalMin * 0.2f);
		}
Esempio n. 20
0
 void StartNewTimer()
 {
     _timer = new FadingTimer(intervalMin * 0.2f, Random.Range(intervalMin, intervalMax), intervalMin * 0.2f);
 }
		public void FadeIn(float time = 1f)
		{
			ClearFading();
			SetMaterialColor(Color.white.WithAlpha(0));
			_fadeInTimer = new FadingTimer(time, time);
			ApplyFadeIn();
		}