public override void OnHit(Transform source) { base.OnHit(source); DmgBehav.SetInvincible(1); ScreenShaker.Shake(.2f, .1f); GetComponentInChildren <PlayerHittedAnimation>().StartAnimation(); }
private void UpdateAnimationScreenshaking(float _Intensity, float _Time, bool _Force = false) { if (m_BattleRoyaleManager.GetWorstPlayer() == m_BattleRoyaleManager.GetHumanPlayer()) { m_ScreenShaker.Shake(_Intensity, 0.1f); } }
private IEnumerator AscendAnimation() { yield return(new WaitForSeconds(1f)); // so the below shake commands won't be overridden by other things still happening in the map ScreenShaker.Clear(); var winner = GameController.GetFirstLivePawn(); // disable physics and such on the pawn winner.GetComponent <Rigidbody>().detectCollisions = false; winner.GetComponent <Rigidbody>().isKinematic = true; // spawn the ascend beam and make it invisibly thin to begin with var beam = Instantiate(PrefabAscendBeam, winner.transform.position, Quaternion.identity); var beamtf = beam.transform; beamtf.localScale = new Vector3(0f, 20f, 0f); while (beamtf.localScale.x < 1f) { // shake the screen as the beam opens up ScreenShaker.Shake(999f, beamtf.localScale.x * 0.08f); // increase the width of the beam over time beamtf.localScale += new Vector3(0.8f * Time.fixedDeltaTime, 0f, 0.8f * Time.fixedDeltaTime); yield return(new WaitForFixedUpdate()); } ScreenShaker.Shake(999f, 0.12f); var ascendProgress = 0f; while (ascendProgress < 1f) { ascendProgress += Time.fixedDeltaTime * 0.6f; winner.transform.localPosition += Vector3.up * Time.fixedDeltaTime * 1.2f; yield return(new WaitForFixedUpdate()); } ExitGamePanel.SetActive(true); // and close the beam again winner.HideSprite(); while (beamtf.localScale.x > 0f) { ScreenShaker.Clear(); ScreenShaker.Shake(999f, beamtf.localScale.x * 0.08f); // increase the width of the beam over time beamtf.localScale -= new Vector3(1f * Time.fixedDeltaTime, 0f, 1f * Time.fixedDeltaTime); yield return(new WaitForFixedUpdate()); } Destroy(beam); ScreenShaker.Clear(); }
private void FeedInteractable() { selectedInteractableTransform.parent.SendMessage("OnFedItem", selectedItem, SendMessageOptions.DontRequireReceiver); SetSelectedItem(ItemType.None); Utility.SendMessageToChildren( transform.parent, "SetInteraction", InteractionCanvasController.Interaction.None, SendMessageOptions.DontRequireReceiver); ScreenShaker.Shake(0.25f, 0.1f); source.PlayOneShot(clips[1]); }
public override void Killed() { base.Killed(); m_Brush.Blink(true); for (int i = 0; i < m_BrushesFollowing.Count; ++i) { m_BrushesFollowing[i].Blink(true); } m_ScreenShaker.Shake(0.5f, 0.2f); m_HapticManager.Vibrate(MobileHapticManager.E_FeedBackType.Failure); }
private IEnumerator Cycle() { yield return(new WaitForSeconds(Delay)); var gobj = Instantiate(PrefabParticles, transform); gobj.transform.localPosition = Vector3.zero; gobj.transform.localRotation = Quaternion.identity; ScreenShaker.Shake(0.3f, 0.3f); XInputWrapper.Instance.AddRumble(0.4f, 0.95f); m_collider.enabled = true; yield return(new WaitForSeconds(0.15f)); m_collider.enabled = false; yield return(new WaitForSeconds(1f)); Destroy(gameObject); }
private void StateChanged(GameManager.eGameState state) { switch (state) { case GameManager.eGameState.RUNNING: //transform.position = startPos; CVC.Follow = camFollow; CVC.LookAt = camFollow; break; case GameManager.eGameState.GAMEOVER: CVC.Follow = null; CVC.LookAt = null; SS.Shake(); break; } }
protected override void DealDamage(CharController target) { target.DmgBehav.DealPhysicalDamage(dmgInfo); MuzzleSpawner.Spawn(target.transform.position); ScreenShaker.Shake(.2f, .1f); }
void Update() { if (Input.GetButtonDown("Interact")) { // Pick up if (selectedItem == ItemType.None) { switch (selectedInteractable) { case ItemType.None: break; case ItemType.Water: SetSelectedItem(selectedInteractable); Utility.SendMessageToChildren( transform.parent, "SetInteraction", InteractionCanvasController.Interaction.None, SendMessageOptions.DontRequireReceiver); source.PlayOneShot(clips[0]); break; case ItemType.Grass: case ItemType.Egg: case ItemType.Carrot: case ItemType.Chicken: SetSelectedItem(selectedInteractable); Utility.PhysicalDestroy(selectedInteractableTransform.parent.gameObject); Utility.SendMessageToChildren( transform.parent, "SetInteraction", InteractionCanvasController.Interaction.None, SendMessageOptions.DontRequireReceiver); source.PlayOneShot(clips[0]); break; } } // Feed else { switch (selectedInteractable) { case ItemType.None: // Eat Utility.SendMessageToChildren(transform.parent, "OnFedItem", selectedItem, SendMessageOptions.DontRequireReceiver); SetSelectedItem(ItemType.None); fedSelf = true; TryMovingPhase(); Utility.SendMessageToChildren( transform.parent, "SetInteraction", InteractionCanvasController.Interaction.None, SendMessageOptions.DontRequireReceiver); ScreenShaker.Shake(0.5f, 0.1f); source.PlayOneShot(clips[2]); break; case ItemType.WaterSpawner: break; case ItemType.GrassSpawner: fedGrass = true; TryMovingPhase(); if (!FeedRules.CanBeFed(selectedInteractable, selectedItem)) { break; } FeedInteractable(); break; case ItemType.CarrotSpawner: fedCarrot = true; TryMovingPhase(); if (!FeedRules.CanBeFed(selectedInteractable, selectedItem)) { break; } FeedInteractable(); break; case ItemType.Chicken: fedChicken = true; TryMovingPhase(); if (!FeedRules.CanBeFed(selectedInteractable, selectedItem)) { break; } FeedInteractable(); break; case ItemType.MrBiscuits: case ItemType.MrBiscuits2: case ItemType.MrBiscuits3: case ItemType.MrBiscuits4: case ItemType.BatSpawner: if (!FeedRules.CanBeFed(selectedInteractable, selectedItem)) { break; } FeedInteractable(); break; } } } }
//OnCollisionEnter will only be called when the other collider has a rigidbody, like our ball has void OnCollisionEnter(Collision c) { //Notify the shaker that there is a collision and pass the direction of the collision to it. //So if the ball bounces onto the left of the screen, the shaker will shake from the right to left and back shaker.Shake(c.relativeVelocity); }