using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerController : MonoBehaviour
|
|
{
|
|
public float walkSpeed;
|
|
|
|
private Vector2 receivedInput;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public void SetMovement(Vector2 input)
|
|
{
|
|
receivedInput = input;
|
|
}
|
|
|
|
public void UpdatePosition()
|
|
{
|
|
float RunnerX, RunnerZ;
|
|
RunnerZ = Input.GetAxisRaw("Vertical");
|
|
RunnerX = Input.GetAxisRaw("Horizontal");
|
|
|
|
//float rotateTo = RotateRunner(RunnerX, RunnerZ);
|
|
|
|
RunnerZ = Input.GetAxis("Vertical") * Time.deltaTime * walkSpeed;
|
|
RunnerX = Input.GetAxis("Horizontal") * Time.deltaTime * walkSpeed;
|
|
|
|
|
|
transform.Translate(RunnerX, 0, RunnerZ);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
UpdatePosition();
|
|
}
|
|
}
|