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 --- WeaponHandler.cs | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 WeaponHandler.cs (limited to 'WeaponHandler.cs') diff --git a/WeaponHandler.cs b/WeaponHandler.cs new file mode 100644 index 0000000..7b3d80f --- /dev/null +++ b/WeaponHandler.cs @@ -0,0 +1,75 @@ +using UnityEngine; + +public class WeaponHandler : MonoBehaviour +{ + [HideInInspector] + public Gun leftGun; + + [HideInInspector] + public Gun rightGun; + + [HideInInspector] + public Transform gunADS; + + [HideInInspector] + public float ADSFOV; + + public bool isDualWeilding; + + private void Start() + { + } + + private void Update() + { + } + + public void SetWeapon(Weapon w, bool mainHand) + { + } + + public void SetGun(Gun g, bool mainHand) + { + if (mainHand) + { + rightGun = g; + gunADS = g.GetComponentInChildren().transform; + ADSFOV = g.ADSFOV; + } + else + { + leftGun = g; + } + if ((bool)leftGun && (bool)rightGun) + { + isDualWeilding = true; + } + } + + public void HoldAttack(bool shootWithRightGun, bool ADS) + { + if (shootWithRightGun) + { + if (rightGun.auto) + { + rightGun.Shoot(base.transform.root, ADS); + } + } + else if (leftGun.auto) + { + leftGun.Shoot(base.transform.root, ADS); + } + } + + public void PressAttack(bool shootWithRightGun, bool ADS) + { + if (shootWithRightGun) + { + rightGun.Shoot(base.transform.root, ADS); + } + else + { + leftGun.Shoot(base.transform.root, ADS); + } + } +} -- cgit v1.1-26-g67d0