//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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 } } }
public override void Begin(Unit unit) { nextMoveTime.Reset(10); unit.AI.NavMeshAgentEnabled = true; unit.AI.UpdatePosition = false; unit.AI.Speed = unit.RunSpeed; unit.AI.AngularSpeed = MovementUtils.MoveRotationSpeed; }
internal void RefreshCombatState() { if (!unit.IsAlive) { return; } combatTimer.Reset(5000); unit.SetFlag(UnitFlags.InCombat); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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(); } }
public override void DoReset(TUnit unit) { nextMoveTime.Reset(0); if (!unit.IsAlive || unit.IsStopped) { return; } unit.AddState(UnitControlState.Confused | UnitControlState.ConfusedMove); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: On FadeIn //--------------------------------------------------- // : Is also called by the Unity Inspector Button // for fading in a scene. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void OnFadeIn() { #if UNITY_EDITOR if (m_lSprRends.Count == 0 || m_ttTransitionTimer == null) { Start(); // In case we call this from the Editor whilst creating the game; We must make sure that the start function has done its job. This isn't a concern when the game is released (or not in Debug Mode) } #endif // We've completed, so make sure everyone knows about it. Oh and Giving the Player the ability to press things might be a good idea too... m_bCompleted = true; ButtonManager.ToggleAllButtons(true); // Reset Fade Effect m_ttTransitionTimer.Reset(); m_eTransitionState = TransitionState.IDLE; // Show all SpriteRenders with Full Opacity foreach (SpriteRenderer sr in m_lSprRends) { // Make Sure the Sprite Renderer is still valid if (sr != null) { Color colour = sr.color; colour.a = 1.0f; sr.color = colour; } } foreach (UnityEngine.UI.Text tr in m_lTextRends) { if (tr != null) { Color colour = tr.color; colour.a = 1.0f; tr.color = colour; } } foreach (UnityEngine.UI.Image ir in m_lImgRends) { if (ir != null) { Color colour = ir.color; colour.a = 1.0f; ir.color = colour; } } // And AudioPlayer as well (Full Volume) if (m_asSoundPlayer != null) { m_asSoundPlayer.volume = 1.0f; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Reset //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void Reset() { if (m_ttTimer != null) { m_ttTimer.Reset(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Stop Cymbal Shake //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void StopCymbalShake() { m_ttTotalShakeTimer.Reset(); ShowUnpressedSprite(); m_bNormalSprite = true; m_bShaking = false; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Extend Right Arm //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void ExtendRightArm() { m_ttRightArmTimer.Reset(); m_bExtendedRightArm = true; m_rAnimator.SetBool(m_ParamHashIDs.ExtendedRightArmParamID, true); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Reset //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void Reset() { m_eVisualPhase = VisualPhase.INTRO; m_ttIntroTimer.Reset(); GetComponent <Collider2D>().enabled = false; GetAnimator().SetBool(m_ParamHashIDs.ExplodingParamID, false); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Perform Rattle Shake Check //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private bool PerformRattleShakeCheck() { // Increment Current Consecutive Shakes Count m_iCurrentRattleShakes += 1; // If the user took too long to make another shake, reset the rattle count if (m_ttRattleTimer.TimeUp()) { m_iCurrentRattleShakes = 1; } // Reset Rattle timer (it would be unfair if we didn't reset the timer and allow the user as much time as possible to make another shake occur) m_ttRattleTimer.Reset(); // Got enough shakes? Awesome. Make the Rattle Sound if (m_iCurrentRattleShakes >= m_iRattleShakesNeeded) { if (!m_bSoundPlayed) { AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.RATTLE_TAMBOURINE_SHAKE)); ShowShakenTambourine(); } m_bSoundPlayed = true; return(true); } return(false); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Wait Time //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdateWaitTime() { if (m_ttWaitTimer.Update()) { m_ttWaitTimer.Reset(); m_eAnimationPhase = AnimationPhase.START; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Reset //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void Reset() { bool bLiftPath = (Random.Range(0, 2) == 0); if (bLiftPath) { CreateLiftPath(); } else { m_ttMovementTransitionTimer.Reset(); m_ttMovementTransitionTimer.FinishTime = Random.Range(m_fMinTimerRange, m_fMaxTimerRange); m_iCurrentElement = 0; m_iTotalElements = 2; CreateStraightPath(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Overwritten Method: Update //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void Update() { // If the Cymbal is shaking if (m_bShaking) { // Time to finish? if (m_ttTotalShakeTimer.Update()) { StopCymbalShake(); } // Time to show other sprite? else if (m_ttShakeIntervalTimer.Update()) { m_ttShakeIntervalTimer.Reset(); ToggleSprite(); } } }
private void UpdateDamageState() { m_ttExplodeWaitTimer.Update(); if (m_ttExplodeWaitTimer.TimeUp()) { m_ttExplodeWaitTimer.Reset(); m_eScreenAttackState = ScreenAttackState.RESET; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Wait Time //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected virtual void UpdateWaitTime() { if (m_ttWaitTimer.Update()) { m_ttWaitTimer.Reset(); if (IsAllowedToAnimate()) { m_eAnimationPhase = AnimationPhase.START; OnAnimationStart(); } } }
public void FadeoutThenFadein(float fromVolume, float toVolume, float defaultVolume, float fadeTime, float waitTime) { if (!IsMuted) { m_fDefaultVolume = defaultVolume; FadeAudio(fromVolume, toVolume, fadeTime); m_eCurrentFadeType = FadeType.FADE_OUT_AND_BACK_IN; m_ttWaitTracker.FinishTime = waitTime; m_ttWaitTracker.Reset(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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())); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Methods: Fade Audio //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void FadeAudio(float fromVolume, float toVolume, float fadeTime) { if (!IsMuted) { IsFading = true; m_eCurrentFadeType = FadeType.REGULAR_FADE; Volume = fromVolume; m_fStartFadeVolume = fromVolume; m_fEndFadeVolume = toVolume; m_ttFadeTracker.FinishTime = fadeTime; m_ttFadeTracker.Reset(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Play Button Wait //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdatePlayButtonWait() { if (m_ttPlayButtonWaitTimer != null) { if (m_ttPlayButtonWaitTimer.Update()) { m_ttPlayButtonWaitTimer.Reset(); ProceedToNextPhase(); } } else { ProceedToNextPhase(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Landscape After Move Wait //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdateLandscapeAfterMoveWait() { if (m_ttLandscapeAfterMoveWaitTimer != null) { if (m_ttLandscapeAfterMoveWaitTimer.Update()) { m_ttLandscapeAfterMoveWaitTimer.Reset(); ProceedToNextPhase(); } } else { ProceedToNextPhase(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Jokos Instrument Name Logo Wait //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdateJokosInstrumentNameLogoWait() { if (m_ttJokosFluteWaitTimer != null) { if (m_ttJokosFluteWaitTimer.Update()) { m_ttJokosFluteWaitTimer.Reset(); ProceedToNextPhase(); } } else { ProceedToNextPhase(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Jokos Dance Wait //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdateJokosDanceWait() { if (m_ttJokosDanceWaitTimer != null) { if (m_ttJokosDanceWaitTimer.Update()) { m_ttJokosDanceWaitTimer.Reset(); ProceedToNextPhase(); } } else { ProceedToNextPhase(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Show Shakened Tambourine //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void ShowShakenTambourine(bool bUseShakeTimer = true, bool bHideTargets = false) { // Reset Shake Visual Cue Timer if (bUseShakeTimer) { if (m_ttShakeRevealTimer != null) { m_bUseShakeTimer = true; m_ttShakeRevealTimer.Reset(); } } // Now show the tambourine for its shaken form m_rInstrumentManager.ShowSpecialInstrumentState(); }
public void StopChallenge(bool showResults) { StopMetronome(); m_ttFinishWaitTimer.Reset(); ButtonManager.ToggleAllButtons(true); if (TutorialManager_Base.TutorialOpened) { m_eChallengePhase = ChallengePhase.STOPPING; } else { m_eChallengePhase = (showResults ? ChallengePhase.RESULTS : ChallengePhase.STOPPING); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Reset //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void Reset() { m_ttFadeinTimer.Reset(); m_ttFadeoutTimer.Reset(); Impacted = false; m_ImpactTargetCollider = null; CollisionDetector = true; m_eAttackPhase = AttackPhase.FADEIN; m_vDirection = (m_vTargetPos - (Vector2)transform.position).normalized; Color alpha = SpriteColour; alpha.a = 0.0f; SpriteColour = alpha; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Redefined Method: Update //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Update() { RaycastHit hit; if (GetComponent <Rigidbody>().SweepTest(transform.forward, out hit, 20)) { if (m_TTButtonEffectTimer.TimeUp()) { m_PauseMenuScriptsObject.GetComponent <PauseScreenButtonEffects>().ActivateButtonEffect(m_eButtonType); m_TTButtonEffectTimer.Reset(); } Destroy(hit.transform.gameObject); } m_TTButtonEffectTimer.Update(); }
internal void DoUpdate(int deltaTime) { gridCellRelocatorTimer.Update(deltaTime); gridCellOutOfRangeTimer.Update(deltaTime); if (gridCellRelocatorTimer.Passed) { for (int i = 0; i < cellCountX; i++) { for (int j = 0; j < cellCountZ; j++) { cells[i, j].Visit(gridCellRelocator); } } foreach (WorldEntity worldEntity in visibilityChangedEntities) { worldEntity.IsVisibilityChanged = false; } foreach (WorldEntity relocatableEntity in relocatableEntities) { Cell currentCell = relocatableEntity.CurrentCell; Cell nextCell = FindCell(relocatableEntity.Position); if (nextCell == null) { relocatableEntity.Position = map.Settings.DefaultSpawnPoint.position; nextCell = FindCell(relocatableEntity.Position); } if (currentCell != nextCell) { currentCell.RemoveWorldEntity(relocatableEntity); nextCell.AddWorldEntity(relocatableEntity); } } visibilityChangedEntities.Clear(); relocatableEntities.Clear(); gridCellRelocatorTimer.Reset(GridRelocatorTime); if (gridCellOutOfRangeTimer.Passed) { gridCellOutOfRangeTimer.Reset(GridRelocatorOutOfRangeTimer); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Reset //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void Reset() { if (Target != null) { m_bPositionChanging = (m_vStartingPosition != m_vEndPosition); m_bRotationChanging = (m_vStartingRotation != m_vEndRotation); m_bScaleChanging = (m_vStartingScale != m_vEndScale); m_bColourChanging = ((m_rSprRend != null || m_rText != null || m_rImage != null) && (m_cStartingColour != m_cEndColour)); m_bFirstUpdate = true; if (m_ttTimer != null) { m_ttTimer.Reset(); } } }