This commit is contained in:
CortexCore
2024-04-19 21:43:30 +08:00
parent e12a6e5a46
commit 3cc6491973
46 changed files with 6792 additions and 23887 deletions

View File

@@ -33,7 +33,8 @@ namespace BITFALL.Entities.Player.Movement
[CustomType(typeof(IEntityMovement))]
[CustomType(typeof(IPlayerMovement))]
[CustomType(typeof(ISensorTarget))]
public class PlayerCharacterController : StateBasedPlayerBehavior<IEntityMovementState>
[CustomType(typeof(PlayerCharacterController))]
public class PlayerCharacterController : StateBasedBehavior<IEntityMovementState>
,IEntityMovement
,IPlayerMovement
,IEntityBinaryComponent
@@ -147,7 +148,7 @@ namespace BITFALL.Entities.Player.Movement
[Inject]
private IHealth _health;
[Inject]
private InputActionGroup _inputActionGroup;
internal InputActionGroup inputActionGroup;
[Inject]
private IKnockdown _knockdown;
[Inject]
@@ -191,12 +192,12 @@ namespace BITFALL.Entities.Player.Movement
TransitionState<Walk>();
_inputActionGroup.RegisterCallback(movementAction, OnMovement);
_inputActionGroup.RegisterCallback(viewAction, OnView);
_inputActionGroup.RegisterCallback(jumpAction, OnJump);
_inputActionGroup.RegisterCallback(crouchAction, OnCrouch);
_inputActionGroup.RegisterCallback(runAction, OnRun);
_inputActionGroup.RegisterCallback(crawlAction, OnCrawl);
inputActionGroup.RegisterCallback(movementAction, OnMovement);
inputActionGroup.RegisterCallback(viewAction, OnView);
inputActionGroup.RegisterCallback(jumpAction, OnJump);
inputActionGroup.RegisterCallback(crouchAction, OnCrouch);
inputActionGroup.RegisterCallback(runAction, OnRun);
inputActionGroup.RegisterCallback(crawlAction, OnCrawl);
}
private void OnCrawl(InputAction.CallbackContext obj)
@@ -259,7 +260,7 @@ namespace BITFALL.Entities.Player.Movement
{
if (MovementInput.z > 0)
{
if (_inputActionGroup.GetAction(runAction).IsPressed())
if (inputActionGroup.GetAction(runAction).IsPressed())
{
ExpectRun.shouldBe = true;
}
@@ -270,7 +271,7 @@ namespace BITFALL.Entities.Player.Movement
ExpectSprint.Reset();
}
}
else if (MovementInput == default && _inputActionGroup.GetAction(runAction).IsPressed() is false)
else if (MovementInput == default && inputActionGroup.GetAction(runAction).IsPressed() is false)
{
ExpectRun.Reset();
ExpectSprint.Reset();
@@ -279,7 +280,7 @@ namespace BITFALL.Entities.Player.Movement
{
ExpectRun.Reset();
ExpectSprint.Reset();
}else if (MovementInput.z > 0 && _inputActionGroup.GetAction(runAction).IsPressed())
}else if (MovementInput.z > 0 && inputActionGroup.GetAction(runAction).IsPressed())
{
ExpectRun.shouldBe = true;
}
@@ -410,6 +411,7 @@ namespace BITFALL.Entities.Player.Movement
{
{ interaction: PressInteraction, performed: true } => true,
{ interaction: PressInteraction, canceled: true } => false,
_ when CurrentState is EdgeClimb => false,
_ => RequestClimb
};