Merge pull request #20 from gjcampbell777/update_controller_settings

Update controller settings
This commit is contained in:
Gregory Campbell
2020-01-05 17:07:59 -05:00
committed by GitHub
4 changed files with 87 additions and 68 deletions
+2 -2
View File
@@ -366,8 +366,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 203887784} m_GameObject: {fileID: 203887784}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 200, y: -0.5, z: 6} m_LocalPosition: {x: 215, y: -0.5, z: 6}
m_LocalScale: {x: 50, y: 0.5, z: 50} m_LocalScale: {x: 75, y: 0.5, z: 75}
m_Children: [] m_Children: []
m_Father: {fileID: 833538478} m_Father: {fileID: 833538478}
m_RootOrder: 2 m_RootOrder: 2
+13 -12
View File
@@ -93,15 +93,15 @@ public class PlayerController : MonoBehaviour
if(maxSpeed > maxSpeedStore) if(maxSpeed > maxSpeedStore)
{ {
maxSpeed -= acceleration/10; maxSpeed -= acceleration/5;
} }
if(maxSpeed < maxSpeedStore && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.LeftControl)) if(maxSpeed < maxSpeedStore && !Input.GetButton("Walk") && !Input.GetButton("Crouch"))
{ {
maxSpeed += acceleration; maxSpeed += acceleration;
} }
if(Input.GetKey(KeyCode.LeftShift)) if(Input.GetButton("Walk"))
{ {
if(maxSpeed > maxSpeedStore/2) if(maxSpeed > maxSpeedStore/2)
{ {
@@ -109,21 +109,21 @@ public class PlayerController : MonoBehaviour
} }
} }
if(Input.GetKey(KeyCode.LeftControl)) if(Input.GetButton("Crouch"))
{ {
characterController.height /= 2; characterController.height /= 2;
capsule.height /= 2; capsule.height /= 2;
transform.localScale = new Vector3(transform.localScale.x, transformHeight/2, transform.localScale.z); transform.localScale = new Vector3(transform.localScale.x, transformHeight/2, transform.localScale.z);
if(Input.GetKeyDown(KeyCode.LeftControl)) if(Input.GetButtonDown("Crouch"))
{ {
if((Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0)) if((Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0))
{ {
sliding = false;
} else {
sliding = true; sliding = true;
slideTime = Time.time; slideTime = Time.time;
} else {
sliding = false;
} }
} }
@@ -160,7 +160,7 @@ public class PlayerController : MonoBehaviour
} else { } else {
slideTime = Time.time; slideTime = Time.time;
if(Input.GetKey(KeyCode.LeftControl)) if(Input.GetButton("Crouch"))
{ {
characterController.height /= 2; characterController.height /= 2;
@@ -177,13 +177,14 @@ public class PlayerController : MonoBehaviour
} }
//Might want to change move direction value to make triggering this speed up effect easier/harder //Might want to change move direction value to make triggering this speed up effect easier/harder
if(diving && moveDirection.y > 0.75 && Input.GetKeyDown(KeyCode.LeftControl)) if(diving && moveDirection.y > 0.75 && Input.GetButtonDown("Crouch"))
{ {
dive++; dive++;
if(dive == 1){ if(dive == 1){
maxSpeed += 10; maxSpeed += 10;
} }
sliding = true;
slideTime = Time.time;
} }
} }
@@ -230,7 +231,7 @@ public class PlayerController : MonoBehaviour
velocity.x += moveDirection.x; velocity.x += moveDirection.x;
velocity.z += moveDirection.z; velocity.z += moveDirection.z;
if(Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0){ if((Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0) || Input.GetButton("Stop")){
//Remove or "lower" friction to add an 'ice' effect //Remove or "lower" friction to add an 'ice' effect
velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, friction); velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, friction);
+3 -1
View File
@@ -8,4 +8,6 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/Test Scene.unity path: Assets/Scenes/Test Scene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {} m_configObjects:
com.unity.input.settings: {fileID: 11400000, guid: 5dbe934aa009ccc4591ccf96f49a3d48,
type: 2}
+69 -53
View File
@@ -38,13 +38,13 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Fire1 m_Name: Crouch
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: left ctrl positiveButton: left ctrl
altNegativeButton: altNegativeButton:
altPositiveButton: mouse 0 altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
@@ -54,29 +54,29 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Fire2 m_Name: Walk
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left alt
altNegativeButton:
altPositiveButton: mouse 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: left shift positiveButton: left shift
altNegativeButton: altNegativeButton:
altPositiveButton: mouse 2 altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Stop
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: mouse 1
altNegativeButton:
altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
@@ -182,11 +182,11 @@ InputManager:
axis: 1 axis: 1
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Fire1 m_Name: Crouch
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: joystick button 0 positiveButton: joystick button 7
altNegativeButton: altNegativeButton:
altPositiveButton: altPositiveButton:
gravity: 1000 gravity: 1000
@@ -198,23 +198,7 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Fire2 m_Name: Walk
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 1
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
@@ -230,11 +214,11 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Jump m_Name: Stop
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: joystick button 3 positiveButton: joystick button 6
altNegativeButton: altNegativeButton:
altPositiveButton: altPositiveButton:
gravity: 1000 gravity: 1000
@@ -246,13 +230,13 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Submit m_Name: Jump
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: return positiveButton: joystick button 1
altNegativeButton: altNegativeButton:
altPositiveButton: joystick button 0 altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
@@ -262,29 +246,61 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Submit m_Name: Mouse X
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: enter positiveButton:
altNegativeButton: altNegativeButton:
altPositiveButton: space altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.25
sensitivity: 1000 sensitivity: 0.1
snap: 0 snap: 0
invert: 0 invert: 0
type: 0 type: 2
axis: 0 axis: 2
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Cancel m_Name: Mouse Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.25
sensitivity: 0.1
snap: 0
invert: 1
type: 2
axis: 3
joyNum: 0
- serializedVersion: 3
m_Name: Pause
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: escape positiveButton: escape
altNegativeButton: altNegativeButton:
altPositiveButton: joystick button 1 altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Pause
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 9
altNegativeButton:
altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000