[내일 배움 캠프 Unity 4기] Final Project W14D1 07.15 TIL

김용준·2024년 7월 15일
0

내일배움캠프

목록 보기
47/47

Goals

  • Utilize the animation without transitition on animation control
  • Apply joystick ui to player input

Switch the animation clip according to state

In Unity, there are many animation clips on one sprite target. The transition has been learned on the animator panel. However, the SPUM, which is adopted for making various type of character with one paid asset, contains the animation switch in the script. Utilizing the script, I have implemented the animation based on the state.

// StateMove.cs
public class StateMove : StateBase
{
  public override void Enter()
  {
    ...
    GetComponent<SPUM_Prefabs>().PlayAnimation("Run");
  }
  ...
}

With the style of upper code snippet, I made the animation control acccording to the state without invoking transition arrow on the control panel. It is regarded as the best choice when the problem hadn't occured. The Attack animation was invoked on the Enter method on StateAttack. Consequently, the attack animation can be seen when I press the attack key during the animation end. The problem is that the attack animation canceled at the end of press. with the this behaviour, we can implement cancel system or just fix it ASAP.


UI joystick on the project

The InputSystem on Unity can utilize the input with various devices either the UI joystick. The script for that purpose is included in the package. The OnScreenStick is one of the script which I need for the input. Applying the script, there are also one more things to be attached on the player. The OnScreenStick only works for the conversion of UI interaction to InputAction. I need to connect the input action to the behaviour. So I modified the InputMove script to contains the connection; addition of joystick on the keybindings. Finally I see the joystick movement which linked with the player.

profile
꿈이큰개발자지망생

0개의 댓글