2023-04-09 21:59:32 -07:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2023-04-09 23:09:21 -07:00
|
|
|
using UnityEngine.InputSystem;
|
2023-04-09 21:59:32 -07:00
|
|
|
|
|
|
|
public class PlayerController : MonoBehaviour
|
|
|
|
{
|
2023-04-09 23:09:21 -07:00
|
|
|
|
|
|
|
Vector2 movementValue;
|
|
|
|
[SerializeField]
|
|
|
|
float speed;
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
Rigidbody2D rb;
|
2023-04-09 21:59:32 -07:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-04-09 23:09:21 -07:00
|
|
|
void OnMove(InputValue value)
|
|
|
|
{
|
|
|
|
this.movementValue = value.Get<Vector2>() * speed;
|
|
|
|
}
|
|
|
|
|
2023-04-09 21:59:32 -07:00
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
2023-04-09 23:09:21 -07:00
|
|
|
this.rb.AddForce(new Vector3(this.movementValue.x, 0, this.movementValue.y));
|
2023-04-09 21:59:32 -07:00
|
|
|
}
|
|
|
|
}
|