From cc55520a19043a7b4870858e962fa3e20c46bc39 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 14 Mar 2024 11:43:40 +0800 Subject: *misc --- CameraRecoil.cs | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 CameraRecoil.cs (limited to 'CameraRecoil.cs') diff --git a/CameraRecoil.cs b/CameraRecoil.cs deleted file mode 100644 index e82532a..0000000 --- a/CameraRecoil.cs +++ /dev/null @@ -1,49 +0,0 @@ -using UnityEngine; - -public class CameraRecoil : MonoBehaviour -{ - public Transform yRotation; - - public Transform xRotation; - - private float counter; - - private float lastValue; - - private AnimationCurve usedCurve; - - private float deltaValue; - - private float xRecoil; - - private float yRecoil; - - private bool hasCurve; - - private void Start() - { - } - - private void Update() - { - if (hasCurve && counter < usedCurve.keys[usedCurve.length - 1].time) - { - float num = usedCurve.Evaluate(counter); - counter += Time.deltaTime; - deltaValue = num - lastValue; - lastValue = num; - xRotation.Rotate(Vector3.up * Time.deltaTime * xRecoil * deltaValue, Space.World); - yRotation.Rotate(Vector3.right * Time.deltaTime * yRecoil * deltaValue, Space.Self); - } - } - - public void AddRecoil(Vector2 recoil, AnimationCurve curve) - { - counter = 0f; - lastValue = curve.Evaluate(0f); - usedCurve = curve; - xRecoil = recoil.x * 30f; - yRecoil = recoil.y * -30f; - hasCurve = true; - } -} -- cgit v1.1-26-g67d0