Skip to content

Commit 8502a0d

Browse files
authored
Merge pull request QianMo#1 from Mr-susu/master
修改下蹲执行逻辑
2 parents e36fe1e + 1084527 commit 8502a0d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Assets/Behavioral Patterns/State Pattern/Exmaple4/DuckingState.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ public void Update()
2222

2323
public void HandleInput()
2424
{
25-
if (Input.GetKeyUp(KeyCode.DownArrow))
25+
if (Input.GetKeyDown(KeyCode.DownArrow))
2626
{
27-
Debug.Log("get GetKeyUp.DownArrow!");
27+
Debug.Log("已经在下蹲躲避状态中!");
28+
return;
29+
}
30+
if (Input.GetKeyUp(KeyCode.UpArrow))
31+
{
32+
Debug.Log("get GetKeyUp.UpArrow!");
2833
_heroine.SetHeroineState(new StandingState(_heroine));
2934
}
3035
}

0 commit comments

Comments
 (0)