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;
					}
				}
			}
		}
Ejemplo n.º 2
0
		// ================================================================================
		//  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;
				}
			}
		}
Ejemplo 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;
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public void FadeOut()
 {
     if (_fadeOutTimer == null)
     {
         _fadeOutTimer = new FadingTimer(0, Actor.TIME_UNTIL_DESTRUCTION, 2.0f);
     }
 }
Ejemplo n.º 5
0
        // ================================================================================
        //  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;
                }
            }
        }
Ejemplo n.º 6
0
 public void FadeIn(float time = 1f)
 {
     ClearFading();
     SetMaterialColor(Color.white.WithAlpha(0));
     _fadeInTimer = new FadingTimer(time, time);
     ApplyFadeIn();
 }
Ejemplo n.º 7
0
 public void FadeOutAfterDeath()
 {
     if (_fadeOutTimer == null)
     {
         ClearFading();
         _fadeOutTimer = new FadingTimer(0, Actor2D.TIME_UNTIL_DESTRUCTION, 2.0f);
     }
 }
Ejemplo 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));
     }
 }
Ejemplo 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;
                    }
                }
            }
        }
Ejemplo 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));
                    }
                }
            }
        }
Ejemplo n.º 11
0
 public void FadeOut(float time = 1f)
 {
     ClearFading();
     _fadeOutTimer = new FadingTimer(0, time, time);
     ApplyFadeOut();
 }
Ejemplo 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);
			}
		}
Ejemplo 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);
			}
		}
Ejemplo 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);
		}
Ejemplo 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();
		}