Added a movement controller, and added a demo scene
This commit is contained in:
@@ -1,19 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
Rigidbody rb;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user