2017-05-07 18:48:56 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class PlayerController : MonoBehaviour {
|
2017-05-07 21:44:35 +02:00
|
|
|
|
public Character Character;
|
2017-05-07 18:48:56 +02:00
|
|
|
|
|
2017-05-08 01:29:12 +02:00
|
|
|
|
private void Update() {
|
|
|
|
|
if (!Term.IsVisible()) {
|
|
|
|
|
// Handle inputs
|
|
|
|
|
Vector3 Move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
|
|
|
|
|
if (Move.sqrMagnitude != 0) {
|
|
|
|
|
Character.Move(transform.TransformDirection(Move));
|
|
|
|
|
} else if (Character.Moving()) {
|
|
|
|
|
Character.Stop();
|
|
|
|
|
}
|
2017-05-07 21:53:01 +02:00
|
|
|
|
} else if (Character.Moving()) {
|
2017-05-08 01:29:12 +02:00
|
|
|
|
// The debug console is open, stop the player.
|
2017-05-07 21:53:01 +02:00
|
|
|
|
Character.Stop();
|
|
|
|
|
}
|
2017-05-07 21:44:35 +02:00
|
|
|
|
}
|
2017-05-07 18:48:56 +02:00
|
|
|
|
}
|