summaryrefslogtreecommitdiff
path: root/CameraRecoil.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-03-14 11:43:40 +0800
committerchai <215380520@qq.com>2024-03-14 11:43:40 +0800
commitcc55520a19043a7b4870858e962fa3e20c46bc39 (patch)
treeb437f788e506a48ec16a215c6965b8170f15d5f6 /CameraRecoil.cs
parent54c872fa42b1ba0fdbcfe812b80bb8eb0cfe108f (diff)
*misc
Diffstat (limited to 'CameraRecoil.cs')
-rw-r--r--CameraRecoil.cs49
1 files changed, 0 insertions, 49 deletions
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;
- }
-}