//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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 } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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 Death //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected void UpdateDeath() { m_ttDeathTimer.Update(); if (m_ttDeathTimer.TimeUp()) { Destroy(gameObject); } }
private void UpdateDamageState() { m_ttExplodeWaitTimer.Update(); if (m_ttExplodeWaitTimer.TimeUp()) { m_ttExplodeWaitTimer.Reset(); m_eScreenAttackState = ScreenAttackState.RESET; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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 } }
// 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); } }
void Update() { if (m_ttActiveTimer != null) { m_ttActiveTimer.Update(); if (m_ttActiveTimer.TimeUp()) { Destroy(gameObject); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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: 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; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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; } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * 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(); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Update //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Update() { if (m_bExtendedLeftArm) { m_ttLeftArmTimer.Update(); if (m_ttLeftArmTimer.TimeUp()) { ContractLeftArm(); } } if (m_bExtendedRightArm) { m_ttRightArmTimer.Update(); if (m_ttRightArmTimer.TimeUp()) { ContractRightArm(); } } }
private void UpdateRevealingState() { m_ttRevealTimer.Update(); if (m_ttRevealTimer.TimeUp()) { m_ttRevealTimer.FinishTime -= (m_ttRevealTimer.FinishTime * 0.1f); m_ttRevealTimer.Reset(); Fireball_ScreenAttackMagic rAttackObject = m_lgoScreenAttackObjects[m_iCurrentAttackElement]; rAttackObject.gameObject.SetActive(true); rAttackObject.BeginAttack(); m_iCurrentAttackElement += 1; if (m_iCurrentAttackElement == m_lgoScreenAttackObjects.Count) { m_eScreenAttackState = ScreenAttackState.WAIT_FOR_PLAYER_ANIMATION; m_rPlayerRef.BeginScreenAttackAnimation(); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void Update() { m_TTTimeValue.Update(); if (m_TTTimeValue.TimeUp()) { m_ASource.volume = m_fEndVolume; DynamicUpdateManager.RemoveFadeEffect(m_ID); } if (m_bFadeIn) { m_ASource.volume = ((m_fEndVolume - m_fStartVolume) * m_TTTimeValue.GetCompletionPercentage()); } else { m_ASource.volume = (m_fStartVolume - (m_fStartVolume * m_TTTimeValue.GetCompletionPercentage())); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Change TextBox Position to Challenge Mode Position //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private IEnumerator ChangeTutorialTextBoxPositionToChallengeMode() { m_bFreezeTutorialUpdate = true; { Vector3 vStartPos = m_rTextBoxTransitionEffect.transform.localPosition; TimeTracker ttLerpTimer = new TimeTracker(m_fPositionLerpTime); while (!ttLerpTimer.TimeUp()) { if (ttLerpTimer.Update()) { m_rTextBoxTransitionEffect.transform.localPosition = m_vChallengeModeTextBoxPosition; } else { m_rTextBoxTransitionEffect.transform.localPosition = Vector3.Lerp(vStartPos, m_vChallengeModeTextBoxPosition, ttLerpTimer.GetCompletionPercentage()); yield return(new WaitForEndOfFrame()); } } } m_bFreezeTutorialUpdate = false; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Update //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Update() { if (m_iCurrentElement < (m_iTotalElements - 1)) { m_ttMovementTransitionTimer.Update(); if (m_ttMovementTransitionTimer.TimeUp()) { m_ttMovementTransitionTimer.Reset(); transform.position = m_vMovementTargets[m_iCurrentElement + 1]; m_iCurrentElement += 1; } else { transform.position = Vector3.Lerp(m_vMovementTargets[m_iCurrentElement], m_vMovementTargets[m_iCurrentElement + 1], m_ttMovementTransitionTimer.GetCompletionPercentage()); } } else { Reset(); } }
// Update is called once per frame void Update() { if (m_ttSpawnCooldownTimer.TimeUp()) { if (m_lgoSpawnObjects.Count > 0) { GameObject NewSpawn = (Instantiate(m_lgoSpawnObjects[0]) as GameObject); // Spawn Object NewSpawn.transform.position = transform.position; // Set Position NewSpawn.transform.parent = m_tSpawnParent; // Set Parent m_lgoSpawnObjects.RemoveAt(0); // Pop Front Element on Spawn List sm_iSpawnQueueCount -= 1; // Decrease Spawn Queue Count m_ttSpawnCooldownTimer.Reset(); // Reset Cooldown Timer m_ttSpawnCooldownTimer.FinishTime = GetSpawnCooldownTime(); // Modify Cooldown Time } } else { m_ttSpawnCooldownTimer.Update(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Is Completed? //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public bool IsCompleted() { return(m_ttTimer != null ? m_ttTimer.TimeUp() : false); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Text //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdateText() { if (!m_aTextArray.AtEndOfArray()) { if (m_SoundFiles.TextSource != null) { if (!m_SoundFiles.TextSource.isPlaying) { m_SoundFiles.TextSource.Play(); } } // Update Text (H...e...l...l...o) and Face Animation, if there is still text if (m_iCurrentCharElement < GetCurrentWindowText().Length) { m_TTTextTimer.Update(); m_TTFaceAnimationTimer.Update(); if (m_TTTextTimer.TimeUp()) { GetLabelScript().text += GetNextCharacter(); m_iCurrentCharElement += 1; m_TTTextTimer.Reset(); } if (m_TTFaceAnimationTimer.TimeUp()) { ContinueToNextFaceAnimation(); m_TTFaceAnimationTimer.Reset(); } } // Otherwise Wait Long Enough for the Text to continue else { if (m_SoundFiles.TextSource != null) { m_SoundFiles.TextSource.Stop(); } // Close the Mouth of the NPC, (NoMoarTxt4U) if (m_eFaceState != FaceState.MOUTH_CLOSED) { ContinueToNextFaceAnimation(); } m_TTEndOfTextWaitTimer.Update(); if (m_TTEndOfTextWaitTimer.TimeUp()) { m_TTEndOfTextWaitTimer.Reset(); m_aTextArray.IncrementElement(); ResetTextDisplay(); } } } // At End of Dialogue else { m_ScrollInfo.Scroll = true; m_ScrollInfo.UpdateText = false; m_ScrollInfo.Dir = ScrollDirection.DOWN; if (m_SoundFiles.FlyOutSource != null && m_SoundFiles.FlyOutSource.Length > 0) { m_SoundFiles.FlyOutSource[Random.Range(0, m_SoundFiles.FlyOutSource.Length)].Play(); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Show Next DialogueBox? //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private bool CanShowNextDialogueBox() { return(m_TimeToDisplayNextTextBox.TimeUp()); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Show Next Character? //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private bool CanShowNextCharacter() { return(m_TimeToDisplayNextTextCharacter.TimeUp()); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Is Completed? //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public bool IsCompleted() { return(m_ttTimer.TimeUp()); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Text Information //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private IEnumerator UpdateTextInformation() { const float fTextDisplayTimer = 3.0f; const float fTextFadeTime = 0.5f; TimeTracker ttTextFadeTimer = new TimeTracker(fTextFadeTime); bool bShowingChallengeName = true; bool bRequiresMoreFeathers = (m_eButtonAvailability == ButtonAvailability.NEED_MORE_FEATHERS); while (true) { // Show Text yield return(new WaitForSeconds(fTextDisplayTimer)); // Fade out Text ttTextFadeTimer.Reset(); while (!ttTextFadeTimer.TimeUp()) { if (ttTextFadeTimer.Update()) { TextOpacity = 0.0f; if (!bShowingChallengeName && bRequiresMoreFeathers) { FeatherOpacity = 0.0f; } } else { TextOpacity = Mathf.Lerp(m_cUnavailableTextColour.a, 0.0f, ttTextFadeTimer.GetCompletionPercentage()); if (!bShowingChallengeName && bRequiresMoreFeathers) { FeatherOpacity = (1.0f - ttTextFadeTimer.GetCompletionPercentage()); } } yield return(new WaitForEndOfFrame()); } // Change Text bShowingChallengeName = !bShowingChallengeName; if (bShowingChallengeName) { if (bRequiresMoreFeathers) { m_rRequiredFeathersIcon.gameObject.SetActive(false); } MultiLanguageTextComponent.ApplyEffects(TextRenderer); } else { if (bRequiresMoreFeathers) { m_rRequiredFeathersIcon.gameObject.SetActive(true); int iFeathers = m_rChallengeManager.GetRequiredFeathersAmountForChallenge(m_eChallengeID); TextRenderer.text = " x" + (iFeathers < 10 ? "0" : "") + iFeathers.ToString(); } else { m_oUnavailableText.ApplyEffects(TextRenderer); } } TextOpacity = 0.0f; // Fade in Text ttTextFadeTimer.Reset(); while (!ttTextFadeTimer.TimeUp()) { if (ttTextFadeTimer.Update()) { TextOpacity = m_cUnavailableTextColour.a; if (!bShowingChallengeName && bRequiresMoreFeathers) { FeatherOpacity = 1.0f; } } else { TextOpacity = Mathf.Lerp(0.0f, m_cUnavailableTextColour.a, ttTextFadeTimer.GetCompletionPercentage()); if (!bShowingChallengeName && bRequiresMoreFeathers) { FeatherOpacity = ttTextFadeTimer.GetCompletionPercentage(); } } yield return(new WaitForEndOfFrame()); } } }