38 lines
753 B
C#
38 lines
753 B
C#
//Oliver
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PlayerController : MonoBehaviour
|
|
{
|
|
[SerializeField] int speed;
|
|
private Vector3 position = Vector3.zero;
|
|
private Text score;
|
|
private int points;
|
|
private Rigidbody rb;
|
|
void Start()
|
|
{
|
|
rb = GetComponent<Rigidbody>();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
position = Vector3.zero;
|
|
if (Input.GetKey(KeyCode.W))
|
|
{
|
|
position += Vector3.forward;
|
|
}
|
|
if (Input.GetKey(KeyCode.A))
|
|
{
|
|
position += Vector3.left;
|
|
}
|
|
if (Input.GetKey(KeyCode.S))
|
|
{
|
|
position += Vector3.back;
|
|
}
|
|
if (Input.GetKey(KeyCode.D))
|
|
{
|
|
position += Vector3.right;
|
|
}
|
|
}
|
|
}
|