Merge branch 'agents/wall-jump-logic-optimization'
# Conflicts: # Assets/_Game/Scripts/Player/PlayerMovement.cs # Assets/_Game/Scripts/Player/States/IdleState.cs # Assets/_Game/Scripts/Player/States/RunState.cs # Assets/_Game/Scripts/Player/States/WallJumpState.cs # Assets/_Game/Scripts/Player/States/WallSlideState.cs
This commit is contained in:
@@ -85,6 +85,20 @@ namespace BaseGames.Player.States
|
||||
_owner.TransitionTo(_owner.GetState<AirAttackState>());
|
||||
return;
|
||||
}
|
||||
|
||||
// ── 抓墙:贴墙 + 朝向墙壁按键,或蹬墙跳后的自动抓墙──────────────
|
||||
var wd = Owner.WallDetector;
|
||||
if (wd != null && wd.IsTouchingWall && !Move.IsGrounded)
|
||||
{
|
||||
int wallDir = wd.WallDirection;
|
||||
bool pressingTowardWall = Mathf.Abs(Input.MoveInput.x) > 0.01f
|
||||
&& (int)Mathf.Sign(Input.MoveInput.x) == wallDir;
|
||||
if (pressingTowardWall || Owner.IsPostWallJump)
|
||||
{
|
||||
_owner.TransitionTo(_owner.GetState<WallSlideState>());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStateFixedUpdate()
|
||||
|
||||
Reference in New Issue
Block a user