From 6ce8b9e22fc13be34b442c7b6af48b42cd44275a Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:00:58 +0800 Subject: +init --- AddScreenShake.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 AddScreenShake.cs (limited to 'AddScreenShake.cs') diff --git a/AddScreenShake.cs b/AddScreenShake.cs new file mode 100644 index 0000000..1d7a2a4 --- /dev/null +++ b/AddScreenShake.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +public class AddScreenShake : MonoBehaviour +{ + public float friction = 0.75f; + + public Vector3 shake = Vector2.zero; + + public Vector3 additionalRandom = Vector3.zero; + + [HideInInspector] + public WobbleShake wobbleShake; + + private void Start() + { + } + + private void Update() + { + } + + public void DoShake() + { + if ((bool)wobbleShake) + { + wobbleShake.AddShake(new Vector3(shake.x + Random.Range(0f - additionalRandom.x, additionalRandom.x), shake.y + Random.Range(0f - additionalRandom.y, additionalRandom.y), shake.z + Random.Range(0f - additionalRandom.z, additionalRandom.z)), friction); + } + } +} -- cgit v1.1-26-g67d0