티스토리 뷰
💻 Unity
Blend Tree (두 개 이상 애니메이션 합쳐서 사용)



Friction(마찰력) 없애기

Friction 0으로 한 후 Rigidbody에 넣어줌
🕹️ 실습 (2D 횡스크롤 2)
플레이어 대쉬 구현

[Header("Dash Info")]
[SerializeField]
private float dashSpeed;
[SerializeField]
private float dashDuration;
// [SerializeField]
private float dashTime;
[SerializeField]
private float dashCooldown;
// [SerializeField]
private float dashCooldownTimer;
private void MovePlayer()
{
xInput = Input.GetAxisRaw("Horizontal");
HandleDash();
if (dashTime > 0)
{
rb.linearVelocity = new Vector2(xInput * dashSpeed, 0);
}
else
{
rb.linearVelocity = new Vector2(xInput * moveSpeed, rb.linearVelocityY);
}
}
private void HandleDash()
{
dashTime -= Time.deltaTime;
dashCooldownTimer -= Time.deltaTime;
if (Input.GetKeyDown(KeyCode.LeftShift) && dashCooldownTimer < 0)
{
dashCooldownTimer = dashCooldown;
dashTime = dashDuration;
}
}
private void HanldeAnimator()
{
animator.SetBool("isDashing", dashTime > 0);
}
공격 콤보 구현


[Header("Attack Info")]
[SerializeField]
private float comboTime = 0.3f;
private float comboTimeCounter;
private bool isAttacking;
private int comboCounter;
private void Attack()
{
comboTimeCounter -= Time.deltaTime;
if (Input.GetKeyDown(KeyCode.Mouse0))
{
isAttacking = true;
comboTimeCounter = comboTime;
}
}
public void FinishAttack()
{
isAttacking = false;
comboCounter++;
if (comboCounter > 2)
{
comboCounter = 0;
}
if (comboTimeCounter < 0)
{
comboCounter = 0;
}
}
📝 과제
캐릭터 리소스 변경해보기
https://github.com/yh97yhyh/likelion-unity-study/tree/main/ShadowDashAssignment
likelion-unity-study/ShadowDashAssignment at main · yh97yhyh/likelion-unity-study
Contribute to yh97yhyh/likelion-unity-study development by creating an account on GitHub.
github.com
'Unity > 멋쟁이사자처럼' 카테고리의 다른 글
멋쟁이 사자처럼 부트캠프 유니티 게임 개발 4기 31일차 회고 (0) | 2025.04.07 |
---|---|
멋쟁이 사자처럼 부트캠프 유니티 게임 개발 4기 30일차 회고 (0) | 2025.04.04 |
멋쟁이 사자처럼 부트캠프 유니티 게임 개발 4기 28일차 회고 (0) | 2025.04.03 |
멋쟁이 사자처럼 부트캠프 유니티 게임 개발 4기 27일차 회고 (0) | 2025.04.03 |
멋쟁이 사자처럼 부트캠프 유니티 게임 개발 4기 23일차 회고 (0) | 2025.04.03 |