29 lines
615 B
C#
29 lines
615 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
public class PlayerController : MonoBehaviour
|
|
{
|
|
[Header("ÔªËØ")]
|
|
[SerializeField] private Joystick playerJoystick;
|
|
|
|
[Header("±äÁ¿")]
|
|
[SerializeField] private float moveSpeed = 5;
|
|
private Rigidbody2D rb;
|
|
|
|
private void Start()
|
|
{
|
|
rb = GetComponent<Rigidbody2D>();
|
|
// rb.velocity = Vector2.right;
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
var v = new Vector3(playerJoystick.Horizontal, playerJoystick.Vertical,0);
|
|
transform.position += v * moveSpeed * Time.deltaTime;
|
|
}
|
|
|
|
}
|
|
|