Commit 0688c38f authored by abpo11's avatar abpo11

플레이어 점프 및 이동속도가 U단위로 재설정됨. 로프를 탈 때 좌우 방향키를 누르면 로프 점프를 무시함. 기타 버그수정

parent 78d115be
...@@ -253,14 +253,13 @@ MonoBehaviour: ...@@ -253,14 +253,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f289cad4933d4bf42ae5c82c57bd88e4, type: 3} m_Script: {fileID: 11500000, guid: f289cad4933d4bf42ae5c82c57bd88e4, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
maxSpeed: 300 maxSpeed: 5
speed: 600 maxDashSpeed: 10
speedAir: 5 accerlation: 600
jumpSpeed: 400 jumpSpeed: 10
ropeSpeed: 200 ropeSpeed: 3
doubleJumpSpeed: 400 doubleJumpSpeed: 10
dashSpeed: 1000 dashAccerlation: 1000
dashDelay: 0
isDashing: 0 isDashing: 0
platformArray: [] platformArray: []
horizontal: 0 horizontal: 0
...@@ -280,8 +279,8 @@ MonoBehaviour: ...@@ -280,8 +279,8 @@ MonoBehaviour:
m_Bits: 4096 m_Bits: 4096
ropeDistance: 0.3 ropeDistance: 0.3
rayDistance: 1 rayDistance: 1
ropeUp: 0.5 ropeUp: 0.6
ropeDown: 0.5 ropeDown: 0.7
--- !u!212 &489222436 --- !u!212 &489222436
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -11,9 +11,9 @@ public class PlayerController : MonoBehaviour ...@@ -11,9 +11,9 @@ public class PlayerController : MonoBehaviour
[SerializeField] [SerializeField]
private float maxSpeed; private float maxSpeed;
[SerializeField] [SerializeField]
private float speed; private float maxDashSpeed;
[SerializeField] [SerializeField]
private float speedAir; private float accerlation;
[SerializeField] [SerializeField]
private float jumpSpeed; private float jumpSpeed;
[SerializeField] [SerializeField]
...@@ -21,9 +21,7 @@ public class PlayerController : MonoBehaviour ...@@ -21,9 +21,7 @@ public class PlayerController : MonoBehaviour
[SerializeField] [SerializeField]
private float doubleJumpSpeed; private float doubleJumpSpeed;
[SerializeField] [SerializeField]
private float dashSpeed; private float dashAccerlation;
[SerializeField]
private float dashDelay;
[SerializeField] [SerializeField]
private bool isDashing = false; private bool isDashing = false;
public TilemapCollider2D[] platformArray; public TilemapCollider2D[] platformArray;
...@@ -100,10 +98,10 @@ public class PlayerController : MonoBehaviour ...@@ -100,10 +98,10 @@ public class PlayerController : MonoBehaviour
StartCoroutine(RopeDelay()); StartCoroutine(RopeDelay());
} }
rb.velocity = new Vector2(0f, verticalRaw * Time.smoothDeltaTime * ropeSpeed); rb.velocity = new Vector2(0f, verticalRaw * ropeSpeed);
} }
else if (verticalRaw != 0 && ropeEnabled) else if (verticalRaw != 0 && ropeEnabled && horizontalRaw == 0)
{ {
isInRope = true; isInRope = true;
rb.gravityScale = 0f; rb.gravityScale = 0f;
...@@ -123,11 +121,11 @@ public class PlayerController : MonoBehaviour ...@@ -123,11 +121,11 @@ public class PlayerController : MonoBehaviour
{ {
if (isGrounded) if (isGrounded)
{ {
vertical = jumpSpeed * Time.smoothDeltaTime; vertical = jumpSpeed;
} }
else if (isJumpable) else if (isJumpable)
{ {
vertical = doubleJumpSpeed * Time.smoothDeltaTime; vertical = doubleJumpSpeed;
isJumpable = false; isJumpable = false;
} }
} }
...@@ -172,18 +170,18 @@ public class PlayerController : MonoBehaviour ...@@ -172,18 +170,18 @@ public class PlayerController : MonoBehaviour
if(isDashing) if(isDashing)
rb.AddForce(horizontalRaw * dashSpeed * Time.smoothDeltaTime * Vector2.right); rb.AddForce(horizontalRaw * dashAccerlation * Time.smoothDeltaTime * Vector2.right);
else else
rb.AddForce(horizontalRaw * speed * Time.smoothDeltaTime * Vector2.right); rb.AddForce(horizontalRaw * accerlation * Time.smoothDeltaTime * Vector2.right);
if (((horizontalRaw == 0) || (rb.velocity.x > 0 && horizontalRaw < 0) if (((horizontalRaw == 0) || (rb.velocity.x > 0 && horizontalRaw < 0)
|| (rb.velocity.x < 0 && horizontalRaw > 0)) && (isGrounded)) || (rb.velocity.x < 0 && horizontalRaw > 0)) && (isGrounded))
{ {
rb.AddForce(rb.velocity.x * (-10f) * Vector2.right * Time.smoothDeltaTime);
rb.AddForce(rb.velocity.x * (-10f) * Vector2.right);
} }
if(isDashing) rb.velocity = new Vector2(Mathf.Clamp(rb.velocity.x, -maxDashSpeed, maxDashSpeed), vertical);
rb.velocity = new Vector2(Mathf.Clamp(rb.velocity.x, -maxSpeed* (isDashing?1.5f:1f) * Time.smoothDeltaTime, maxSpeed*(isDashing ? 1.5f : 1f) * Time.smoothDeltaTime), vertical); else
rb.velocity = new Vector2(Mathf.Clamp(rb.velocity.x, -maxSpeed , maxSpeed ), vertical);
} }
jump = false; jump = false;
} }
...@@ -209,10 +207,16 @@ public class PlayerController : MonoBehaviour ...@@ -209,10 +207,16 @@ public class PlayerController : MonoBehaviour
} }
public IEnumerator DownPlatform() public IEnumerator DownPlatform()
{ {
platformArray[2].enabled = false; foreach (TilemapCollider2D element in platformArray)
yield return new WaitForSeconds(0.3f); {
platformArray[2].enabled = true; if (element.name == "platform")
isDownPlatform = false; {
element.enabled = false;
yield return new WaitForSeconds(0.3f);
element.enabled = true;
isDownPlatform = false;
}
}
} }
public IEnumerator RopeDelay() public IEnumerator RopeDelay()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment