//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Fade Effect
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateFadeEffect()
    {
        // If the fadein timer has completed (or I got impatient on the PC); Show the Scene Fully Opaque / Fully Transparent
#if UNITY_EDITOR
        if (m_ttTransitionTimer.Update() || Input.GetKeyDown(KeyCode.Space))
#else
        if (m_ttTransitionTimer.Update())
#endif
        {
            if (m_eTransitionState == TransitionState.FADEIN)
            {
                OnFadeIn();
            }
            else
            {
                OnFadeout();
            }
            m_eTransitionState = TransitionState.IDLE;
        }

        // Otherwise Fade in/out scene according to the completion percentage of the timer.
        else
        {
            float t = Mathf.Lerp(0.0f, 1.0f, (m_eTransitionState == TransitionState.FADEIN ? m_ttTransitionTimer.GetCompletionPercentage() : 1.0f - m_ttTransitionTimer.GetCompletionPercentage()));
            foreach (SpriteRenderer sr in m_lSprRends)
            {
                // Make Sure the Sprite Renderer is still valid
                if (sr != null)
                {
                    Color colour = sr.color;
                    colour.a = t;
                    sr.color = colour;
                }
            }
            foreach (UnityEngine.UI.Text tr in m_lTextRends)
            {
                if (tr != null)
                {
                    Color colour = tr.color;
                    colour.a = t;
                    tr.color = colour;
                }
            }
            foreach (UnityEngine.UI.Image ir in m_lImgRends)
            {
                if (ir != null)
                {
                    Color colour = ir.color;
                    colour.a = t;
                    ir.color = colour;
                }
            }

            // If there is a Sound Player for BGM, fade in/out the audio volume also
            if (m_asSoundPlayer != null)
            {
                m_asSoundPlayer.volume = Mathf.Lerp(0.0f, 1.0f, t);
            }
        }
    }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Stopping Phase
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateStoppingPhase()
 {
     if (m_ttFinishWaitTimer.Update())
     {
         CurrentChallenge.StopChallenge();
         m_eChallengePhase = ChallengePhase.INACTIVE;
     }
 }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public bool UpdateAnimation(float fAnimationSpeed = 1.0f)
    {
        if (!IsCompleted())
        {
            if (m_bFirstUpdate)
            {
                OnFirstUpdate();
            }


            // If timer is finished. Finish Animation
            if (m_ttTimer.Update(fAnimationSpeed))
            {
                if (m_bPositionChanging)
                {
                    Target.localPosition = m_vEndPosition;
                }
                if (m_bRotationChanging)
                {
                    Target.localRotation = Quaternion.Euler(m_vEndRotation);
                }
                if (m_bScaleChanging)
                {
                    Target.localScale = m_vEndScale;
                }
                if (m_bColourChanging)
                {
                    UpdateColour(m_cEndColour, m_cEndColour, 1.0f);
                }
            }

            // Otherwise Update it according to Timer Completion Percentage
            else
            {
                float t = m_ttTimer.GetCompletionPercentage();
                if (m_bPositionChanging)
                {
                    Target.localPosition = Vector3.Lerp(m_vStartingPosition, m_vEndPosition, t);
                }
                if (m_bRotationChanging)
                {
                    Target.localRotation = Quaternion.Euler(Vector3.Lerp(m_vStartingRotation, m_vEndRotation, t));
                }
                if (m_bScaleChanging)
                {
                    Target.localScale = Vector3.Lerp(m_vStartingScale, m_vEndScale, t);
                }
                if (m_bColourChanging)
                {
                    UpdateColour(m_cStartingColour, m_cEndColour, t);
                }
            }
        }
        return(IsCompleted());
    }
Ejemplo n.º 4
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* Derived Method: Update
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void Update()
    {
        if (CheckForShake)
        {
#if UNITY_EDITOR
            UpdateShakeReveal();                                // Update Shake Visual Cue (If it is showing)
            m_ttRattleTimer.Update();                           // Update Rattle Timer (if the next shake exceeds this timer, then rattle must be reset)

            if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                // If we did not cause a rattle sound
                if (!PerformRattleShakeCheck())
                {
                    // Make a shake sound
                    PerformTambShakeCheck();
                }
            }
            else
            {
                m_bSoundPlayed = false;
            }
#else
            UpdateAcceleration();                       // Update Movement Speed (Check Device Gyroscope)
            UpdateShakeReveal();                        // Update Shake Visual Cue (If it is showing)
            m_ttRattleTimer.Update();                   // Update Rattle Timer (if the next shake exceeds this timer, then rattle must be reset)

            // If we aren't already checking acceleration
            if (!m_bCheckingAcceleration)
            {
                // Have we at least STARTED moving?
                if (IsMoving())
                {
                    // GOOD. Make movement start noise!
                    AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.MOVE_TAMBOURINE_SOUND));
                    m_bCheckingAcceleration = true;
                }
            }

            // If we are checking acceleration and it has been long enough since the last noise to make a new one. Check for shake
            if (m_bCheckingAcceleration && !m_bTimeout)
            {
                PerformTambShakeCheck();
            }

            // No movement? Don;t bother checking for shake.
            if (!IsMoving())
            {
                m_bSoundPlayed          = false;
                m_bCheckingAcceleration = false;
            }
#endif
        }
    }
Ejemplo n.º 5
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Regular Fade
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateRegularFade()
 {
     if (m_ttFadeTracker.Update())
     {
         IsFading           = false;
         m_eCurrentFadeType = FadeType.NO_FADE;
         Volume             = m_fEndFadeVolume;
     }
     else
     {
         Volume = Mathf.Lerp(m_fStartFadeVolume, m_fEndFadeVolume, m_ttFadeTracker.GetCompletionPercentage());
     }
 }
Ejemplo n.º 6
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Surfacing Stance
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateSurfacingStance()
    {
        m_TTSurfaceTime.Update();

        if (m_TTSurfaceTime.TimeUp())
        {
            // Start Playing Surface Animation (begins next frame)
            StartPlayingSurfaceAnimation();

            // If Playing Surfacing Animation, Set Surfaced bool to true, so this Animation never plays again.
            if (IsPlayingAnimation(GetAnimationStateHashIDs().SurfacingStateID))
            {
                float fMovementSpeed = 100.0f * Time.deltaTime;
                GetLocalTransform().position += (m_vOriginalPosition - GetWorldPosition()).normalized * fMovementSpeed;
                if ((m_vOriginalPosition - GetWorldPosition()).magnitude < (fMovementSpeed * 2.0f))
                {
                    GetLocalTransform().position = m_vOriginalPosition;
                }
                GetAnimatorComponent().SetBool(GetAnimationParamHashIDs().HasSurfacedParamID, true);
            }

            // If Not playing Surfacing Animation and HasSurfaced? is ON.
            else if (IsNotPlayingAnimation(GetAnimationStateHashIDs().SurfacingStateID) && GetAnimatorComponent().GetBool(GetAnimationParamHashIDs().HasSurfacedParamID))
            {
                SetCurrentStance(Stance.IDLE);                                                  // Change to Idle Stance
                m_TTFireCooldown.Reset();                                                       // Reset Shoot Cooldown Timer
            }
        }
    }
Ejemplo n.º 7
0
        private void RespawnAllDeadNpcs(TimeSpan time)
        {
            if (IsMaxSpawnCountReached)
            {
                return;
            }

            ModifyRespawnMultiplier();

            //kinn van-e minden kello member?
            if (MembersCount >= Configuration.FlockMemberCount)
            {
                return;
            }

            if (_nextSpawnTime == null)
            {
                _nextSpawnTime = GetNextSpawnTime();
            }

            _nextSpawnTime.Update(time);

            if (!_nextSpawnTime.Expired)
            {
                return;
            }

            CreateMemberInZone();
            _nextSpawnTime = null;
        }
Ejemplo n.º 8
0
        public void Update(TimeSpan time)
        {
            if (Expirable)
            {
                if (_expired)
                {
                    return;
                }

                _expiry.Update(time);

                if (_expiry.Expired)
                {
                    OnExpired();
                }
            }

            if (!_updated)
            {
                return;
            }

            _saveTimer.Update(time);

            if (!_saveTimer.Passed)
            {
                return;
            }

            _saveTimer.Reset();

            _updated = false;
            OnUpdated();
        }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Death
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 protected void UpdateDeath()
 {
     m_ttDeathTimer.Update();
     if (m_ttDeathTimer.TimeUp())
     {
         Destroy(gameObject);
     }
 }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Wait Time
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateWaitTime()
 {
     if (m_ttWaitTimer.Update())
     {
         m_ttWaitTimer.Reset();
         m_eAnimationPhase = AnimationPhase.START;
     }
 }
 private void UpdateDamageState()
 {
     m_ttExplodeWaitTimer.Update();
     if (m_ttExplodeWaitTimer.TimeUp())
     {
         m_ttExplodeWaitTimer.Reset();
         m_eScreenAttackState = ScreenAttackState.RESET;
     }
 }
        public void Update(TimeSpan time)
        {
            _timer.Update(time);

            if (_timer.Expired)
            {
                Expired();
            }
        }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public bool UpdateAnimation(float fAnimationSpeed = 1.0f)
    {
        if (!IsCompleted())
        {
            // If timer is finished. Finish Animation
            if (m_ttTimer.Update(fAnimationSpeed))
            {
                UpdateColour(m_cEndColour, m_cEndColour, 1.0f);
            }

            // Otherwise Update it according to Timer Completion Percentage
            else
            {
                UpdateColour(m_cStartingColour, m_cEndColour, m_ttTimer.GetCompletionPercentage());
            }
        }
        return(IsCompleted());
    }
Ejemplo n.º 14
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Idle Stance
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateIdleStance()
 {
     m_TTFireCooldown.Update();
     if (m_TTFireCooldown.TimeUp())                              // If Shoot Cooldown Timer is Complete
     {
         SetCurrentStance(Stance.SHOOTING);                      // Begin Shoot Stance
         StartPlayingShootAnimation();                           // Play Shoot Animation
     }
 }
Ejemplo n.º 15
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Single Line Character Highlight Effect
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateSingleLineHighlightEffect()
    {
        // No Highlight happening? Great, wait for a little while then set everything up to make it happen.
        if (IsEmptyHighlight())
        {
            if (m_ttHighlightEffectWaitTimer.Update())
            {
                m_ttHighlightEffectWaitTimer.Reset();
                SetupCharacterHighlightEffects(false);
            }
        }

        // Update Hightlight Effect, obviously
        else
        {
            m_rTextRenderer.text = GetSingleLineCharacterHighlightEffect(m_alOrderedCharacters[0], 0, m_sFullDisplayText.Length);
        }
    }
    // Update is called once per frame
    void Update()
    {
        transform.position = (transform.position + (transform.forward * m_fSpeed * DynamicUpdateManager.GetDeltaTime()));

        m_TTSelfDestruct.Update();
        if (m_TTSelfDestruct.TimeUp())
        {
            DestroyImmediate(gameObject);
        }
    }
Ejemplo n.º 17
0
        protected virtual void Update()
        {
            if (Time.timeSinceLevelLoad < delay)
            {
                return;
            }

            fps.Update(Time.deltaTime);
            timeTracker.Update(Time.deltaTime);
        }
Ejemplo n.º 18
0
        protected override void OnActiveUpdate(int deltaTime)
        {
            base.OnActiveUpdate(deltaTime);

            emoteTimeTracker.Update(deltaTime);
            if (emoteTimeTracker.Passed && randomEmotes.Count > 0)
            {
                Unit.ModifyEmoteState(RandomUtils.GetRandomElement(randomEmotes));
                emoteTimeTracker.Reset(RandomUtils.Next(emoteIntervalMin, emoteIntervalMax));
            }
        }
 void Update()
 {
     if (m_ttActiveTimer != null)
     {
         m_ttActiveTimer.Update();
         if (m_ttActiveTimer.TimeUp())
         {
             Destroy(gameObject);
         }
     }
 }
        protected override void OnActiveUpdate(int deltaTime)
        {
            base.OnActiveUpdate(deltaTime);

            castTimeTracker.Update(deltaTime);
            if (castTimeTracker.Passed)
            {
                Unit.Spells.CastSpell(spellInfo, new SpellCastingOptions());
                castTimeTracker.Reset(RandomUtils.Next(castIntervalMin, castIntervalMax));
            }
        }
Ejemplo n.º 21
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Recent Untouched
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 protected void UpdateRecentUntouched()
 {
     m_bDoubleTapActive = true;
     if (m_ttDoubleTapTimer.Update())
     {
         m_ttDoubleTapTimer.Reset();
         m_bDoubleTapActive = false;
         m_bIsTouched       = false;
         OnTouchRelease();
     }
 }
Ejemplo n.º 22
0
            public bool Update(TimeSpan time)
            {
                _spawnTimer.Update(time);

                if (!_spawnTimer.Expired)
                {
                    return(false);
                }

                _presence.SpawnRandomFlock(_randomFlockConfiguration);
                return(true);
            }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Wait Time
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 protected virtual void UpdateWaitTime()
 {
     if (m_ttWaitTimer.Update())
     {
         m_ttWaitTimer.Reset();
         if (IsAllowedToAnimate())
         {
             m_eAnimationPhase = AnimationPhase.START;
             OnAnimationStart();
         }
     }
 }
Ejemplo n.º 24
0
            void IUnitBehaviour.DoUpdate(int deltaTime)
            {
                if (InCombat)
                {
                    combatTimer.Update(deltaTime);

                    if (combatTimer.Passed)
                    {
                        ResetCombat();
                    }
                }
            }
Ejemplo n.º 25
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Shake Reveal
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateShakeReveal()
 {
     // Show the tambourine facing towards the player once the timer is complete.
     if (m_bUseShakeTimer)
     {
         if (m_ttShakeRevealTimer.Update())
         {
             m_bUseShakeTimer = false;
             ShowNormalTambourine();
         }
     }
 }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Intro Phase
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateIntroPhase()
 {
     m_ttIntroTimer.Update();
     if (m_ttIntroTimer.TimeUp())
     {
         m_eVisualPhase = VisualPhase.IDLE;
         Scale.Set(m_vIntroEndScale);
     }
     else
     {
         Scale.Set(Vector3.Lerp(m_vIntroStartScale, m_vIntroEndScale, m_ttIntroTimer.GetCompletionPercentage()));
     }
 }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Background Blur
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateBackgroundBlur()
 {
     if (m_ttLanscapeBlurTimer.Update())
     {
         m_ttLanscapeBlurTimer.Reset();
         m_srBackgroundSpriteRenderer.material.SetFloat("_Distance", m_fLandscapeBlurDistance);
         ProceedToNextPhase();
     }
     else
     {
         m_srBackgroundSpriteRenderer.material.SetFloat("_Distance", Mathf.Lerp(0.0f, m_fLandscapeBlurDistance, m_ttLanscapeBlurTimer.GetCompletionPercentage()));
     }
 }
Ejemplo n.º 28
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Fade out
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void FadeOut()
 {
     m_ttFadeoutTimer.Update();
     if (m_ttFadeoutTimer.TimeUp())
     {
         this.gameObject.SetActive(false);
     }
     else
     {
         Color alpha = SpriteColour;
         alpha.a      = Mathf.Lerp(m_fFadeoutStartAlpha, 0.0f, m_ttFadeoutTimer.GetCompletionPercentage());
         SpriteColour = alpha;
     }
 }
Ejemplo n.º 29
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Fade in
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void FadeIn()
 {
     m_ttFadeinTimer.Update();
     if (m_ttFadeinTimer.TimeUp())
     {
         SpriteColour   = Color.white;
         m_eAttackPhase = AttackPhase.MOVING;
     }
     else
     {
         Color alpha = SpriteColour;
         alpha.a      = Mathf.Lerp(0.0f, 1.0f, m_ttFadeinTimer.GetCompletionPercentage());
         SpriteColour = alpha;
     }
 }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Play Button Wait
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdatePlayButtonWait()
 {
     if (m_ttPlayButtonWaitTimer != null)
     {
         if (m_ttPlayButtonWaitTimer.Update())
         {
             m_ttPlayButtonWaitTimer.Reset();
             ProceedToNextPhase();
         }
     }
     else
     {
         ProceedToNextPhase();
     }
 }