using System.Collections; using System.Collections.Generic; using Mirror; using UnityEngine; public class AtkDummyGun : Launcher { private void Start() { if (isServer && isClient && isOwned) { type = GunType.GongJiGun; GunInfo gunInfo = GameManager.Ins.GunInfos[type][1]; shootRate = gunInfo.ShootRate; recoil = gunInfo.Recoil; userTime = gunInfo.Time; curUserTime = gunInfo.Time; waitBulletTime = gunInfo.CoolDown; if (hand == HandType.Left) { MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger); } else if (hand == HandType.Right) { MRInput.Ins.RegisterHoldPressRightTrigger(ClickRrightTrigger); } } // 主机其他 else if (isServer && isClient) { type = GunType.GongJiGun; GunInfo gunInfo = GameManager.Ins.GunInfos[type][1]; shootRate = gunInfo.ShootRate; recoil = gunInfo.Recoil; userTime = gunInfo.Time; curUserTime = gunInfo.Time; //bullet_amount=gunInfo.BulletAmount; waitBulletTime = gunInfo.CoolDown; } // 从机自身 else if (isClient && isOwned) { if (hand == HandType.Left) { MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger); } else if (hand == HandType.Right) { MRInput.Ins.RegisterHoldPressRightTrigger(ClickRrightTrigger); } } } public void Update() { if (!isOwned) { return; } // 左手 if (hand == HandType.Left) { transform.position = GameLocal.Ins.self.LeftHand.position; transform.rotation = GameLocal.Ins.self.LeftHand.rotation; } // 右手 else if (hand == HandType.Right) { transform.position = GameLocal.Ins.self.RightHand.position; transform.rotation = GameLocal.Ins.self.RightHand.rotation; } } [Client] public void ClickLeftTrigger() { CmdShoot(); } [Client] public void ClickRrightTrigger() { CmdShoot(); } [Command] public void CmdShoot() { Shoot(); } }