중요하지 않은 코드 별도 study 폴더로 이

This commit is contained in:
Mingu Kim
2025-08-19 20:55:26 +09:00
parent 21a2003830
commit 9ecbcc3396
3 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMove2 : MonoBehaviour
{
[SerializeField]
float speed;
[SerializeField]
float jumpPower;
float inputValue;
Rigidbody2D rigidBody;
SpriteRenderer spriteRenderer;
// TODO : 걷기, 점프 등 애니메이션
Animator animator;
void Awake()
{
rigidBody = GetComponent<Rigidbody2D>();
spriteRenderer = GetComponent<SpriteRenderer>();
animator = GetComponent<Animator>();
}
void FixedUpdate()
{
rigidBody.linearVelocityX = inputValue * speed;
}
void LateUpdate()
{
}
private void OnMove(InputValue value)
{
inputValue = value.Get<Vector2>().x;
}
private void OnJump()
{
rigidBody.AddForceY(jumpPower, ForceMode2D.Impulse);
}
}