This commit is contained in:
CortexCore
2023-10-24 23:37:59 +08:00
parent 325f63d6bc
commit 3e39e627bc
388 changed files with 29043 additions and 889 deletions

View File

@@ -10,6 +10,7 @@ using UnityEngine.InputSystem;
using BITKit.StateMachine;
using Cysharp.Threading.Tasks;
using Unity.Mathematics;
using UnityEditorInternal;
using UnityEngine.InputSystem.Interactions;
#if UNITY_EDITOR
using UnityEditor;
@@ -95,7 +96,7 @@ namespace BITFALL.Guns
[Inject]
private IHealth _health;
private static readonly int IsGrounded = Animator.StringToHash("IsGrounded");
private AssetableGun _gun=>item as AssetableGun;
private bool isHolstered;
#region
@@ -209,15 +210,12 @@ namespace BITFALL.Guns
public override void OnUpdate(float deltaTime)
{
//CurrentState?.OnStateUpdate(deltaTime);
UpdateState(deltaTime);
switch (assetable.FireMode)
{
case AutoFireMode:
expectFiring.shouldBe = fireAction.action.IsPressed();
break;
case SemiFireMode:
expectFiring.shouldBe = fireAction.action.WasPressedThisFrame();
break;
case BurstFireMode when expectFiring.being:
expectFiring.shouldBe = fireAction.action.WasPressedThisFrame();
@@ -273,7 +271,8 @@ namespace BITFALL.Guns
pos = (_transform.position+rotation * bulletInitialOffset).Fix(),
rot = rotation,
forward = _transform.forward.Fix(),
initialDamage = 32,
initialDamage = _gun.InitialDamage,
InitialForce = _gun.InitialBulletForce,
});
//播放枪口MuzzleFlash
@@ -313,7 +312,29 @@ namespace BITFALL.Guns
}
private void OnFire(InputAction.CallbackContext context)
{
switch (assetable.FireMode)
{
case AutoFireMode :
switch (context)
{
case {interaction:TapInteraction , started:true}:
expectFiring.shouldBe = true;
break;
case {interaction:TapInteraction , performed:true}:
case {interaction:HoldInteraction , canceled:true}:
expectFiring.shouldBe = false;
break;
}
break;
case SemiFireMode:
switch (context)
{
case { interaction: TapInteraction, started: true }:
expectFiring.shouldBe = true;
break;
}
break;
}
}
private void OnAim(InputAction.CallbackContext context)
{