1
0
Fork 0

changed inputs to not be hardcoded, fix #19

This commit is contained in:
Jan 2018-04-23 16:24:59 +02:00
parent 18ec2c326f
commit 569e5216aa
4 changed files with 24 additions and 8 deletions

View file

@ -23,7 +23,7 @@ public class Player : Mob {
void Update() {
if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) {
if ( Input.GetKey(KeyCode.Space) ) {
if ( Input.GetAxis("Fire") > 0 ) {
Debug.Log("Attack pressed!");
attack.Attack();
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime();

View file

@ -36,13 +36,13 @@ public class PlayerMovement : MonoBehaviour {
{ // Forward
Vector3 acc = transform.up * acceleration;
if (Input.GetKey(KeyCode.S))
if (Input.GetAxis("Vertical") < 0)
acc *= 0;
rb.AddForce(acc);
}
{// Drag
Vector3 drag = speedVec.normalized * speed * speed * friction * -1;
if (Input.GetKey(KeyCode.S)) {
if (Input.GetAxis("Vertical") < 0) {
drag *= brake;
drag *= speed;
}
@ -57,10 +57,10 @@ public class PlayerMovement : MonoBehaviour {
//Debug.Log(br);
Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false);
}
if ( Input.GetKey(KeyCode.A) )
if ( Input.GetAxis("Horizontal") < 0 )
rb.MoveRotation(rb.rotation + turnSpeed);
//transform.Rotate(Vector3.forward * turnSpeed);
if ( Input.GetKey(KeyCode.D) )
if ( Input.GetAxis("Horizontal") > 0 )
rb.MoveRotation(rb.rotation - turnSpeed);
//transform.Rotate(Vector3.forward * -turnSpeed);
// Debug lines

View file

@ -25,7 +25,7 @@ public class UIController : MonoBehaviour
void Update() {
if (Input.GetKey(KeyCode.R) && GameController.instance.GameEnded()) {
if (Input.GetAxis("Reset") > 0 && GameController.instance.GameEnded()) {
LoadSceneByIndex(firstSceneIndex);
}
}

View file

@ -38,11 +38,11 @@ InputManager:
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
m_Name: Fire
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left ctrl
positiveButton: space
altNegativeButton:
altPositiveButton: mouse 0
gravity: 1000
@ -293,3 +293,19 @@ InputManager:
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Reset
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: r
altNegativeButton:
altPositiveButton: return
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0