public void increaseCameraShake() { if (switchBetweenMagAndRough) { currentMag += 0.5f; } else { currentRough += 0.5f; } shaker.StartFadeOut(2f); shaker = CameraShaker.Instance.StartShake(currentMag, currentRough, 0.5f); shaker.DeleteOnInactive = true; switchBetweenMagAndRough = !switchBetweenMagAndRough; }
private IEnumerator transition_to_game() { m_cage.SetTrigger("Bust"); m_hamster.SetTrigger("Bust"); m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_PathPosition = 0.3f; m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_ZDamping = 10.0f; m_cage.speed = 1.0f; m_hamster.speed = 1.0f; m_shake_instance.Magnitude = m_shake_curve_mag.Evaluate(1.0f); m_shake_instance.Roughness = m_shake_curve_rough.Evaluate(1.0f); m_shake_instance.StartFadeOut(1.0f); float time_left = 3f; while (time_left > 0.0f) { if (time_left >= 2f) { Vector3 pos = m_shake_instance.UpdateShake(); m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_PathOffset = pos; } else { m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_PathOffset = Vector3.zero; } yield return(null); time_left -= Time.deltaTime; } to_gameplay(); }
private void OnTriggerExit(Collider c) { if (c.CompareTag("Player")) { _shakeInstance.StartFadeOut(3f); } }
IEnumerator ShakeTheCameraRoutine(float duration) { instance = CameraShaker.Instance.StartShake(1f, 1f, 0.25f); yield return(new WaitForSeconds(duration)); instance.StartFadeOut(0.5f); }
IEnumerator SetGameOverScreen() { yield return(new WaitForSeconds(1)); shaker.StartFadeOut(1f); resetScene(); GameController.instance.EndGame(false); }
public void StopRolling() { if (shake != null) { shake.StartFadeOut(1f); shake = null; NormalMood(); } }
//When the player exits the trigger, stop shaking. void OnTriggerExit(Collider c) { //Check to make sure the object that exited the trigger was the player. if (c.CompareTag("Player")) { //Fade out the shake over 3 seconds. _shakeInstance.StartFadeOut(3f); } }
//When the player exits the trigger, stop shaking. private void OnTriggerExit2D(Collider2D c) { //Check to make sure the object that exited the trigger was the player. if (c.CompareTag("Player")) { //Fade out the shake over 3 seconds. shake.StartFadeOut(0); } }
private void SetUpShakeInstance() { shakeInstance = CameraShaker.Instance.StartShake(cameraShakeMagnitude, cameraShakeRoughness, cameraShakeFadeInTime); shakeInstance.DeleteOnInactive = false; shakeInstance.StartFadeOut(0); shakeInstance.PositionInfluence = screenShakePositionVariance; shakeInstance.RotationInfluence = screenShakeRotationVariance; }
private void OnMouseUp() { if (_stateManager.currentPlayerState == StateManager.PlayerState.Dead || isDragging == false) { _lineRenderer.enabled = false; return; } _dangerIndicator.HideDangerIndicator(); _dangerIndicator.ToggleCollider(false); isDragging = false; _timescaleManager.ResetTimescale(); _postProcessingManager.EnableMotionBlur(true); _chargingShake.StartFadeOut(0f); _positionToMoveTowards = Camera.main.ScreenToWorldPoint(Input.mousePosition); //TODO switch to LineCast RaycastHit2D[] hits = Physics2D.RaycastAll(transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position, Vector2.Distance(Camera.main.ScreenToWorldPoint(Input.mousePosition), transform.position)); int enemiesHit = 0; foreach (RaycastHit2D hit in hits) { if (hit.collider.gameObject.tag.Equals("Enemy")) { enemiesHit++; hit.collider.gameObject.GetComponent <Enemy>().TriggerDeath(); } } _playerScoreManager.CalculateKills(enemiesHit); _lineRenderer.enabled = false; LeanTween.cancel(_cameraZoom.tweenId); LeanTween.cancel(_vignetteId); _vignette.color = new Color(1f, 1f, 1f, 0f); _cameraZoom.ResetZoom(); _rigidbody.position = _positionToMoveTowards; }
// Start is called before the first frame update void Start() { shake = CameraShaker.Instance.StartShake(shakeIntensity, shakeFrequency, shakeFadein); shake.StartFadeOut(0); shake.DeleteOnInactive = false; healthBar.SetMaxHealth(lives); instance = this; audioSource = controller.GetComponent <AudioSource>(); }
// Use this for initialization void Start() { CS = CameraShaker.Instance; _shakePlayerInstance = CS.StartShake(5, 10, 0, new Vector3(0.2f, 0.4f), new Vector3(0, 0, 0)); _shakePlayerInstance.StartFadeOut(0); _shakePlayerInstance.DeleteOnInactive = false; _shakeShieldInstance = CS.StartShake(3, 10, 0, new Vector3(0.4f, 0.2f), new Vector3(0, 0, 0)); _shakeShieldInstance.StartFadeOut(0); _shakeShieldInstance.DeleteOnInactive = false; }
void Start() { //We make a single shake instance that we will fade in and fade out when the player enters and leaves the trigger area. _shakeInstance = CameraShakerManager.GetCameraShaker("Main Camera").StartShake(2, 15, 2); //Immediately make the shake inactive. _shakeInstance.StartFadeOut(0); //We don't want our shake to delete itself once it stops shaking. _shakeInstance.DeleteOnInactive = true; }
void Start() { //We make a single shake instance that we will fade in and fade out when the player enters and leaves the trigger area. shake = CameraShaker.Instance.StartShake(2f, 2f, 0.1f); //Immediately make the shake inactive. shake.StartFadeOut(0); //We don't want our shake to delete itself once it stops shaking. shake.DeleteOnInactive = false; }
private void ScreenShake(bool isFiring) { if (isFiring) { CameraShaker.Instance.ShakeOnce(cameraShakeMagnitude, cameraShakeRoughness, fadeInTime: 0, fadeOutTime: cameraShakeFadeOutTime); } else { shakeInstance.StartFadeOut(cameraShakeFadeOutTime); } }
public void CameraStartShake(bool fadeIn) { if (fadeIn) { shakeInstance.StartFadeIn(1f); } else { shakeInstance.StartFadeOut(3f); } }
// Update is called once per frame void Update() { if (firstSong && !scroller.hasStarted) { lastRoutine = StartCoroutine(PlaySong(scroller)); } else if (secondSong && !scroller.hasStarted) { var buttons = buttonContainer.GetComponentsInChildren <Button>(); for (int i = 0; i < buttons.Length; i++) { Destroy(buttons[i].gameObject); } lastRoutine = StartCoroutine(PlaySong(scroller)); } if (finishedSong) { audioSource.clip = ogSong; audioSource.Play(); audioSource.loop = true; if (firstSong) // Hmmm... how? If you see this, congradulation, you are a dance god! { firstSong = false; dialogueText.SetActive(true); shake.StartFadeOut(0); scroller.hasStarted = false; scroller.gameObject.SetActive(false); } else if (secondSong) // Successfully passed! Send them to the credit scene { secondSong = false; dialogueTextTMP.text = "Congradulations! You have completed this challenge!"; dialogueText.SetActive(true); shake.StartFadeOut(0); scroller.hasStarted = false; scroller.gameObject.SetActive(false); StartCoroutine(LoadLevelByName(8, "Credit")); } } }
IEnumerator SpawnWaves() { CameraShakeInstance c = CameraShaker.Instance.StartShake(shakeMagnitude, shakeRoughness, shakeFadeIn); for (int i = 0; i < numberOfWaves; i++) { //spawn a wave targetController.createWave(Random.Range(0.5f, 1f)); yield return(new WaitForSeconds(intervalBetweenWaves)); } yield return(new WaitForSeconds(5)); c.StartFadeOut(shakeFadeOut); }
private IEnumerator myShake(ShakeType shakeType) { switch (shakeType) { case ShakeType.Soft: CameraShakeInstance instance = CameraShaker.Instance.StartShake(1.5f, 1f, 1f); yield return(new WaitForSeconds(2f)); instance.StartFadeOut(1f); break; case ShakeType.Medium: CameraShakeInstance instance2 = CameraShaker.Instance.StartShake(2f, 2f, 1f); yield return(new WaitForSeconds(2f)); instance2.StartFadeOut(1f); break; case ShakeType.Hard: CameraShakeInstance instance3 = CameraShaker.Instance.StartShake(3f, 3f, 1f); yield return(new WaitForSeconds(2f)); instance3.StartFadeOut(1f); break; case ShakeType.SoftLong: CameraShakeInstance instance4 = CameraShaker.Instance.StartShake(1.5f, 1f, 1f); yield return(new WaitForSeconds(4f)); instance4.StartFadeOut(1f); break; case ShakeType.Custom: CameraShakeInstance instance5 = CameraShaker.Instance.StartShake(3f, 3f, 1f); yield return(new WaitForSeconds(2.4f)); instance5.StartFadeOut(0.2f); break; default: Debug.LogError("Invalid Shake type - ask Hudson"); break; } isAnimating = false; yield return(null); }
private void ShootGravGun(float ShotCharge) { HoldingObject.AddForce((HoldingObject.transform.position - transform.position) * shootForce * ShotCharge, ForceMode.Force); HoldingObject.interpolation = initialInterpolationSetting; if (shakeInstance != null) { shakeInstance.StartFadeOut(0.1f); shakeInstance = null; } CameraShaker.Instance.ShakeOnce(chargeValue, 15f, 0.1f, 1f); HoldingObject.useGravity = true; HoldingObject = null; chargeValue = 0.0f; chargeSlider.value = chargeValue; }
IEnumerator WaitForRumble(CameraShakeInstance instance, float timeIn, float timeOut) { instance.DeleteOnInactive = false; SetBoolTypes(true); yield return(new WaitForSecondsRealtime(timeIn)); instance.StartFadeOut(timeOut); yield return(new WaitForSecondsRealtime(timeOut)); instance.DeleteOnInactive = true; if (instance.CurrentState == CameraShakeState.Inactive) { SetBoolTypes(false); AllControllersVibrate(0f); // set up needed to turn individual player controllers off if its only affecting certain players } }
private void Start() { playerShipMovement = playerShip.GetComponent <Scr_PlayerShipMovement>(); playerShipActions = playerShip.GetComponent <Scr_PlayerShipActions>(); mainCamera = GetComponent <Camera>(); desiredUp = transform.up; if (playerShipMovement.currentPlanet != null) { zoomInPlanet = zoomInPlanetRatio * playerShipMovement.currentPlanet.GetComponent <Scr_Planet>().planetSize; } mainCamera.orthographicSize = zoomInPlanet; smoothRotation = true; shakeInstance = CameraShaker.Instance.StartShake(magnitude, roughness, fadeOutTime); shakeInstance.StartFadeOut(0); shakeInstance.DeleteOnInactive = true; }
public static void ShakeAfterDeath() { _shakePlayerInstance.StartFadeIn(0); _shakePlayerInstance.StartFadeOut(1); }
void OnGUI() { if (Input.GetKeyDown(KeyCode.R)) { // Application.LoadLevel(Application.loadedLevel); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } Slider s = delegate(float val, string prefix, float min, float max, int pad) { GUILayout.BeginHorizontal(); GUILayout.Label(prefix, GUILayout.MaxWidth(pad)); val = GUILayout.HorizontalSlider(val, min, max); GUILayout.Label(val.ToString("F2"), GUILayout.MaxWidth(50)); GUILayout.EndHorizontal(); return(val); }; GUI.Box(new Rect(10, 10, 250, Screen.height - 15), "Make-A-Shake"); GUILayout.BeginArea(new Rect(29f, 40, 215, Screen.height - 40)); GUILayout.Label("--Position Infleunce--"); posInf.x = s(posInf.x, "X", 0, 4, 25); posInf.y = s(posInf.y, "Y", 0, 4, 25); posInf.z = s(posInf.z, "Z", 0, 4, 25); GUILayout.Label("--Rotation Infleunce--"); rotInf.x = s(rotInf.x, "X", 0, 4, 25); rotInf.y = s(rotInf.y, "Y", 0, 4, 25); rotInf.z = s(rotInf.z, "Z", 0, 4, 25); GUILayout.Label("--Other Properties--"); magn = s(magn, "Magnitude:", 0, 10, 75); rough = s(rough, "Roughness:", 0, 20, 75); fadeIn = s(fadeIn, "Fade In:", 0, 10, 75); fadeOut = s(fadeOut, "Fade Out:", 0, 10, 75); GUILayout.Label("--Saved Shake Instance--"); GUILayout.Label("You can save shake instances and modify their properties at runtime."); if (shake == null && GUILayout.Button("Create Shake Instance")) { shake = CameraShaker.Instance.StartShake(magn, rough, fadeIn); shake.DeleteOnInactive = false; } if (shake != null) { if (GUILayout.Button("Delete Shake Instance")) { shake.DeleteOnInactive = true; shake.StartFadeOut(fadeOut); shake = null; } if (shake != null) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Fade Out")) { shake.StartFadeOut(fadeOut); } if (GUILayout.Button("Fade In")) { shake.StartFadeIn(fadeIn); } GUILayout.EndHorizontal(); modValues = GUILayout.Toggle(modValues, "Modify Instance Values"); if (modValues) { shake.ScaleMagnitude = magn; shake.ScaleRoughness = rough; shake.PositionInfluence = posInf; shake.RotationInfluence = rotInf; } } } GUILayout.Label("--Shake Once--"); GUILayout.Label("You can simply have a shake that automatically starts and stops too."); if (GUILayout.Button("Shake!")) { CameraShakeInstance c = CameraShaker.Instance.ShakeOnce(magn, rough, fadeIn, fadeOut); c.PositionInfluence = posInf; c.RotationInfluence = rotInf; } GUILayout.EndArea(); float height; if (!showList) { height = 120; } else { height = 120 + CameraShaker.Instance.ShakeInstances.Count * 130f; } GUI.Box(new Rect(Screen.width - 310, 10, 300, height), "Shake Instance List"); GUILayout.BeginArea(new Rect(Screen.width - 285, 40, 255, Screen.height - 40)); GUILayout.Label("All shake instances are saved and stacked as long as they are active."); showList = GUILayout.Toggle(showList, "Show List"); if (showList) { int index = 1; foreach (CameraShakeInstance c in CameraShaker.Instance.ShakeInstances) { string state = c.CurrentState.ToString(); GUILayout.Label("#" + index + ": Magnitude: " + c.Magnitude.ToString("F2") + ", Roughness: " + c.Roughness.ToString("F2")); GUILayout.Label(" Position Influence: " + c.PositionInfluence); GUILayout.Label(" Rotation Influence: " + c.RotationInfluence); GUILayout.Label(" State: " + state); GUILayout.Label("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"); index++; } } GUILayout.EndArea(); }
private void Start() { _shakeInstance = CameraShaker.Instance.StartShake(2f, 15f, 2f); _shakeInstance.StartFadeOut(0f); _shakeInstance.DeleteOnInactive = true; }
public void ShakeDieStop() { myShake.StartFadeOut(1f); }
public void StopStorm() { m_storm = false; m_stormAnimator.SetBool("activated", m_storm); m_stormShake.StartFadeOut(5f); }
public void Update() { //Follow Camera Vector3 newPos = transform.position; newPos.x = Camera.main.transform.position.x; newPos.y = Camera.main.transform.position.y; transform.position = newPos; if (begin || reverse) { if (begin) { progress += Time.unscaledDeltaTime / fadeInDuration; } else { progress -= Time.unscaledDeltaTime / fadeInDuration; } progress = Mathf.Clamp01(progress); if (EnterPortion > float.Epsilon && progress < EnterPortion) { Circle.SetActive(true); Circle.transform.localScale = (progress / EnterPortion) * scaleTarget; } if (begin && progress > EnterPortion) { Freeze.SetActive(true); } if (reverse && progress < EnterPortion) { Freeze.SetActive(false); } if (LeavePortion > float.Epsilon && progress > 1 - LeavePortion) { Circle.transform.localScale = ((1f - progress) / LeavePortion) * scaleTarget; } circleMaterial.SetFloat("_Offset", progress * WarpSpeed); circleMaterial.SetFloat("_Hue", progress * targetHue); if (begin && progress >= 0.99f) { begin = false; reverse = false; InWorld = true; Circle.SetActive(false); cameraShake.StartFadeOut(2f); } else if (reverse && progress <= 0.01f) { begin = false; reverse = false; InWorld = false; Circle.SetActive(false); cameraShake.StartFadeOut(1f); PostEffect.SetActive(false); Freeze.SetActive(false); } } }
public static void ShakeAfterShieldHit() { _shakeShieldInstance.StartFadeIn(0); _shakeShieldInstance.StartFadeOut(.5f); }