개발일지

241018(금) [팀과제 input 리펙토링]

게임 프로그래머 2024. 10. 18. 23:59

오늘은 구 input 대신 new input system으로 리펙토링 했다. 

 

기존 input manager가 지워져서 ball과 충돌이 있었으나 

 

input system 타입을 바꾸고 vector2 → float(좌우만 움직이므로 vector2 필요없음)

 

PlayerInputController에서 public float moveInput 선언한뒤

 

ball.cs에서 아래 코드 가져오는 부분을 수정하여 오류 수정

PlayerInputController inputController;

void Start()
{
    inputController = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerInputController>();
...생략
}

 

switch문과도 충돌이 있었으나 팀원분의 도움으로

public 선언한 PlayerInputController의 moveinput을 호출해서 오류해결!

switch (inputController.moveInput)
{
    case -1f:
        BallRotationEX = BallRotation;//?÷???? ????? ???????? ????? ??
        break;
    case 0f:
        int zeroRadom = Random.Range(-1, 2);
        BallRotationEX = (BallRotation * zeroRadom);//??????? -1,0,1?? ????? ??
        break;
    case 1f:
        BallRotationEX = (-1f) * BallRotation;//?÷???? ????? ?????????? ????? ??
        break;
    default:
        break;
}