From e4796a0e484da746c0a98284a410af0e322d1fbd Mon Sep 17 00:00:00 2001 From: "aube.lee" Date: Mon, 10 Mar 2025 00:14:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=BA=90=EB=A6=AD=ED=84=B0=EA=B0=80=20?= =?UTF-8?q?=EB=AA=AC=EC=8A=A4=ED=84=B0=20=EC=9C=84=EC=97=90=20=EC=9E=88?= =?UTF-8?q?=EB=8D=94=EB=9D=BC=EB=8F=84=20=EC=B5=9C=EB=8C=80=205=EB=B2=88?= =?UTF-8?q?=EA=B9=8C=EC=A7=80=EB=8A=94=20=EC=A0=90=ED=94=84=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Gameton/Scripts/Character/CharacterBase.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs b/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs index 33735851..164dcf8a 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs @@ -23,6 +23,8 @@ namespace TON [SerializeField] private WallChecker wallChecker; + [SerializeField] private int jumpLimit = 5; + private int jumpCount = 0; private bool isGrounded = true; // 플레이어가 바닥에 있는지 여부를 판단 private bool isAttack = false; // 플레이어가 기본 공격중인지 판단단 private float lastDirection = 1f; // 기본적으로 오른쪽(1) 바라보는 상태 @@ -58,6 +60,7 @@ namespace TON public void Initialize() { + jumpCount = 0; playerData = PlayerDataManager.Singleton.player; currentHP = maxHP = playerData.hp; @@ -87,6 +90,11 @@ namespace TON { isGrounded = CheckIsGrounded(); + if (isGrounded) + { + jumpCount = 0; + } + // 무한 기본공격 적용되지 않도록 기본공격 모션 중에 이동 제한 if (isAttack) return; @@ -161,10 +169,11 @@ namespace TON public void Jump() { // 바닥에 있을 때만 점프 가능 - if (isGrounded) + if (jumpCount < jumpLimit) { // 점프: 기존 X축 속도 유지, Y축 속도를 점프 힘으로 설정 rb.velocity = new Vector2(rb.velocity.x, jumpForce); + jumpCount++; } }