1. 리소스 메니저 생성 2. 풀 매니저 생성 3. 조이스틱 생성 - 조이스틱 이미지 잘 움직이는것도 확인 함 To-Do 1. 조이스틱과 플레이어 캐릭터를 연결하는 로직 2. 몬스터 이동 로직을 고민해서 구현해보기
16 lines
497 B
C#
16 lines
497 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class JoystickPlayerExample : MonoBehaviour
|
|
{
|
|
public float speed;
|
|
public VariableJoystick variableJoystick;
|
|
public Rigidbody rb;
|
|
|
|
public void FixedUpdate()
|
|
{
|
|
Vector3 direction = Vector3.forward * variableJoystick.Vertical + Vector3.right * variableJoystick.Horizontal;
|
|
rb.AddForce(direction * speed * Time.fixedDeltaTime, ForceMode.VelocityChange);
|
|
}
|
|
} |