軌跡記錄器更改成Raw Input

This commit is contained in:
Sahik committed 2026-10-23 03:42:16 +08:00
1 parent 14140797ba
commit ec0708d05b
17 files changed
+605 -316

No files matched your search

+6 -5
View File
@@ -65,7 +65,7 @@ public class HitscanWeapon : MonoBehaviour
UpdateModelKick();
// 選單開著 (滑鼠沒鎖定) 時不能開槍
if (Cursor.lockState != CursorLockMode.Locked || Mouse.current == null) return;
if (Cursor.lockState != CursorLockMode.Locked) return;
if (Keyboard.current != null && Keyboard.current.rKey.wasPressedThisFrame)
{
@@ -73,8 +73,8 @@ public class HitscanWeapon : MonoBehaviour
}
bool trigger = data.fullAuto
? Mouse.current.leftButton.isPressed
: Mouse.current.leftButton.wasPressedThisFrame;
? RawMouseInput.LeftHeld
: RawMouseInput.LeftPressedThisFrame;
if (trigger && !IsReloading && Time.time >= nextFireTime)
{
@@ -106,6 +106,9 @@ public class HitscanWeapon : MonoBehaviour
sprayIndex++;
lastShotTime = Time.time;
// 先通知開槍,再判定命中 : 記錄裡的順序才會是 shot → hit
Fired?.Invoke();
// 先射擊再加後座力 : 這一發打在準心上,後座力影響的是下一發
for (int i = 0; i < Mathf.Max(1, data.pellets); i++)
{
@@ -123,8 +126,6 @@ public class HitscanWeapon : MonoBehaviour
{
Destroy(Instantiate(muzzleFlashPrefab, muzzlePoint.position, muzzlePoint.rotation, muzzlePoint), 0.05f);
}
Fired?.Invoke();
}
// 霰彈的固定圖案 : 第 0 顆在正中間,其餘平均排在散布半徑的圓上