ofb/Assets/Scripts/PlayerController.cs
2023-04-09 23:09:21 -07:00

32 lines
614 B
C#

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