[Update] 에셋 및 애니메이션
1. 캐릭터, 배경 에셋 변경 2. 캐릭터 애니메이션 적용 3. 방향키에 따른 캐릭터 회전 적용
This commit is contained in:
@@ -41,13 +41,31 @@ public class PlayerController : MonoBehaviour
|
||||
float xSpeed = x * speed;
|
||||
float zSpeed = z * speed;
|
||||
|
||||
bool moveInput = (x != 0 || z != 0);
|
||||
|
||||
Vector3 newVelocity = new Vector3(xSpeed, 0f, zSpeed);
|
||||
|
||||
playerRigidbody.linearVelocity = newVelocity;
|
||||
|
||||
if(moveInput)
|
||||
{
|
||||
Vector3 moveDirection = new Vector3(x, 0f, z);
|
||||
|
||||
Quaternion newRotation = Quaternion.LookRotation(moveDirection);
|
||||
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 0.2f);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1) && shieldCount > 0 && !isShieldActive) //1숫자가 눌리고 카운트가 1이상이고 실드가 활동한 상태이면
|
||||
{
|
||||
StartCoroutine(ActivateShield()); //비동기적으로 함수를 발동하라
|
||||
}
|
||||
|
||||
Animator anim = GetComponentInChildren<Animator>();
|
||||
if (anim != null)
|
||||
{
|
||||
anim.SetBool("isMoving", moveInput);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateShieldUI()
|
||||
|
||||
Reference in New Issue
Block a user