This commit is contained in:
CortexCore
2024-03-25 16:08:26 +08:00
parent 65d90d1bfa
commit 967ad8eacf
67 changed files with 3097 additions and 39530 deletions

View File

@@ -39,10 +39,13 @@ namespace BITFALL.Guns.States
case Equip:
break;
default:
PlayAnimation();
OnMovementStateChanged(null, _entityMovement.CurrentState);
if (_entityMovement.CurrentState is IPlayerWalkState)
PlayAnimation();
else
OnMovementStateChanged(null, _entityMovement.CurrentState);
break;
}
_selector.OnActive += OnActive;
boltActionImmediately = root.RequireBolt;
@@ -123,13 +126,18 @@ namespace BITFALL.Guns.States
_expectRun = newState is IPlayerRunState or IPlayerSprintState;
if (newState is IPlayerSlideState)
{
root.TransitionState<Movement>();
PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Slide)).ToArray());
if (root.CurrentState != this)
root.TransitionState<Movement>();
PlayAnimation(BITConstant.Player.Slide);
//root.animator.CrossFade(BITConstant.Player.Slide, 0.32f);
}else if (newState is IPlayerDodgeState)
}
else if (newState is IPlayerDodgeState)
{
PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Dodge)).ToArray());
}else if (Enabled)
if (root.CurrentState != this)
root.TransitionState<Movement>();
PlayAnimation(BITConstant.Player.Dodge);
}
else if (Enabled)
{
switch (newState)
{
@@ -172,7 +180,11 @@ namespace BITFALL.Guns.States
else if(_expectRun == false)
{
root.TransitionState<Movement>();
}
}
else
{
currentState.Speed = _entityMovement.LocomotionBasedVelocity.GetLength() / _entityMovement.ReferenceSpeed;
}
}
private void OnAim(InputAction.CallbackContext context)
{
@@ -194,8 +206,9 @@ namespace BITFALL.Guns.States
private ExpectState<bool> _expectSprint;
public override void OnStateEntry(IState old)
{
base.OnStateEntry(old);
//root.animator.CrossFade(BITConstant.Player.Sprint, 0.32f);
PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Sprint)).ToArray());
//PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Sprint)).ToArray());
root.inputActionGroup.RegisterCallback(root.aimAction, OnAim);
}
@@ -209,6 +222,10 @@ namespace BITFALL.Guns.States
{
root.TransitionState<Movement>();
}
else
{
currentState.Speed = _entityMovement.LocomotionBasedVelocity.GetLength() / _entityMovement.ReferenceSpeed;
}
}
private void OnAim(InputAction.CallbackContext context)
{
@@ -227,17 +244,19 @@ namespace BITFALL.Guns.States
{
public override void OnStateEntry(IState old)
{
switch (old)
{
case IPlayerRunState:
case IPlayerSprintState:
//root.animator.CrossFade(BITConstant.Player.Aim, 0.32f);
PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Aim)).ToArray());
break;
default:
PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Aim)).ToArray());
break;
}
// switch (old)
// {
// case IPlayerRunState:
// case IPlayerSprintState:
// //root.animator.CrossFade(BITConstant.Player.Aim, 0.32f);
// PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Aim)).ToArray());
// break;
// default:
// PlayAnimation(root.SearchKey.Append(nameof(BITConstant.Player.Aim)).ToArray());
// break;
// }
base.OnStateEntry(old);
_entityMovement.ExecuteCommand<PlayerPauseRunCommand>(new(this,true));
_entityMovement.ExecuteCommand(new PlayerLimitMoveSpeedCommand()
@@ -267,6 +286,8 @@ namespace BITFALL.Guns.States
root.Fire();
}
equipService.Aim = currentState.Weight;
if (BITAppForUnity.AllowCursor)
{
root.TransitionState<Movement>();
@@ -351,7 +372,7 @@ namespace BITFALL.Guns.States
public override void OnStateEntry(IState old)
{
base.OnStateEntry(old);
_entityMovement.ExecuteCommand<PlayerPauseRunCommand>(new(this,true));
if (root.RequireBolt)