summaryrefslogtreecommitdiff
path: root/GameCode/CopyPlayerAim.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-10-27 11:05:14 +0800
committerchai <215380520@qq.com>2023-10-27 11:05:14 +0800
commit766cdff5ffa72b65d7f106658d1603f47739b2ba (patch)
tree34d7799a94dfa9be182825577583c0fa6dc935f7 /GameCode/CopyPlayerAim.cs
+ init
Diffstat (limited to 'GameCode/CopyPlayerAim.cs')
-rw-r--r--GameCode/CopyPlayerAim.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/GameCode/CopyPlayerAim.cs b/GameCode/CopyPlayerAim.cs
new file mode 100644
index 0000000..46f2300
--- /dev/null
+++ b/GameCode/CopyPlayerAim.cs
@@ -0,0 +1,32 @@
+using UnityEngine;
+
+public class CopyPlayerAim : MonoBehaviour
+{
+ public float spreadPerLevel;
+
+ public float spread;
+
+ private AttackLevel level;
+
+ private void Start()
+ {
+ level = GetComponentInParent<AttackLevel>();
+ }
+
+ public void Go()
+ {
+ float num = Random.Range(0f - spread, spread);
+ float num2 = 0f;
+ if ((bool)level)
+ {
+ num2 = (float)level.attackLevel * spreadPerLevel;
+ }
+ num += Random.Range(0f - num2, num2);
+ Holding component = base.transform.root.GetComponent<Holding>();
+ if ((bool)component)
+ {
+ base.transform.rotation = component.holdable.GetComponentInChildren<ShootPos>().transform.rotation;
+ }
+ base.transform.Rotate(Vector3.Cross(Vector3.forward, base.transform.forward) * num);
+ }
+}