changed inputs to not be hardcoded, fix #19
This commit is contained in:
parent
18ec2c326f
commit
569e5216aa
4 changed files with 24 additions and 8 deletions
|
@ -23,7 +23,7 @@ public class Player : Mob {
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) {
|
if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) {
|
||||||
if ( Input.GetKey(KeyCode.Space) ) {
|
if ( Input.GetAxis("Fire") > 0 ) {
|
||||||
Debug.Log("Attack pressed!");
|
Debug.Log("Attack pressed!");
|
||||||
attack.Attack();
|
attack.Attack();
|
||||||
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime();
|
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime();
|
||||||
|
|
|
@ -36,13 +36,13 @@ public class PlayerMovement : MonoBehaviour {
|
||||||
|
|
||||||
{ // Forward
|
{ // Forward
|
||||||
Vector3 acc = transform.up * acceleration;
|
Vector3 acc = transform.up * acceleration;
|
||||||
if (Input.GetKey(KeyCode.S))
|
if (Input.GetAxis("Vertical") < 0)
|
||||||
acc *= 0;
|
acc *= 0;
|
||||||
rb.AddForce(acc);
|
rb.AddForce(acc);
|
||||||
}
|
}
|
||||||
{// Drag
|
{// Drag
|
||||||
Vector3 drag = speedVec.normalized * speed * speed * friction * -1;
|
Vector3 drag = speedVec.normalized * speed * speed * friction * -1;
|
||||||
if (Input.GetKey(KeyCode.S)) {
|
if (Input.GetAxis("Vertical") < 0) {
|
||||||
drag *= brake;
|
drag *= brake;
|
||||||
drag *= speed;
|
drag *= speed;
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@ public class PlayerMovement : MonoBehaviour {
|
||||||
//Debug.Log(br);
|
//Debug.Log(br);
|
||||||
Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false);
|
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);
|
rb.MoveRotation(rb.rotation + turnSpeed);
|
||||||
//transform.Rotate(Vector3.forward * turnSpeed);
|
//transform.Rotate(Vector3.forward * turnSpeed);
|
||||||
if ( Input.GetKey(KeyCode.D) )
|
if ( Input.GetAxis("Horizontal") > 0 )
|
||||||
rb.MoveRotation(rb.rotation - turnSpeed);
|
rb.MoveRotation(rb.rotation - turnSpeed);
|
||||||
//transform.Rotate(Vector3.forward * -turnSpeed);
|
//transform.Rotate(Vector3.forward * -turnSpeed);
|
||||||
// Debug lines
|
// Debug lines
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class UIController : MonoBehaviour
|
||||||
|
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if (Input.GetKey(KeyCode.R) && GameController.instance.GameEnded()) {
|
if (Input.GetAxis("Reset") > 0 && GameController.instance.GameEnded()) {
|
||||||
LoadSceneByIndex(firstSceneIndex);
|
LoadSceneByIndex(firstSceneIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,11 @@ InputManager:
|
||||||
axis: 0
|
axis: 0
|
||||||
joyNum: 0
|
joyNum: 0
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
m_Name: Fire1
|
m_Name: Fire
|
||||||
descriptiveName:
|
descriptiveName:
|
||||||
descriptiveNegativeName:
|
descriptiveNegativeName:
|
||||||
negativeButton:
|
negativeButton:
|
||||||
positiveButton: left ctrl
|
positiveButton: space
|
||||||
altNegativeButton:
|
altNegativeButton:
|
||||||
altPositiveButton: mouse 0
|
altPositiveButton: mouse 0
|
||||||
gravity: 1000
|
gravity: 1000
|
||||||
|
@ -293,3 +293,19 @@ InputManager:
|
||||||
type: 0
|
type: 0
|
||||||
axis: 0
|
axis: 0
|
||||||
joyNum: 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue