File tree Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ GameObject:
10
10
- 4 : {fileID: 402906}
11
11
- 114 : {fileID: 11447320}
12
12
- 114 : {fileID: 11479902}
13
+ - 114 : {fileID: 11435634}
13
14
m_Layer : 0
14
15
m_Name : Debug
15
16
m_TagString : Untagged
@@ -29,6 +30,17 @@ Transform:
29
30
m_Children : []
30
31
m_Father : {fileID: 0}
31
32
m_RootOrder : 0
33
+ --- !u!114 &11435634
34
+ MonoBehaviour :
35
+ m_ObjectHideFlags : 1
36
+ m_PrefabParentObject : {fileID: 0}
37
+ m_PrefabInternal : {fileID: 100100000}
38
+ m_GameObject : {fileID: 101550}
39
+ m_Enabled : 1
40
+ m_EditorHideFlags : 0
41
+ m_Script : {fileID: 11500000, guid: 97c5bb23a7720e74f8566205e046d014, type: 3}
42
+ m_Name :
43
+ m_EditorClassIdentifier :
32
44
--- !u!114 &11447320
33
45
MonoBehaviour :
34
46
m_ObjectHideFlags : 1
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ public void Parse(int inputState)
35
35
currentInput . setYaw ( cameraAim . yaw ) ;
36
36
37
37
currentInput . inputJump = Input . GetButton ( "Jump" ) ;
38
+ currentInput . inputFire = Input . GetButton ( "Fire1" ) ;
39
+ currentInput . inputAim = Input . GetButton ( "Fire2" ) ;
40
+ currentInput . inputRun = Input . GetButton ( "Run" ) ;
38
41
}
39
42
}
40
43
@@ -53,10 +56,14 @@ public struct InputState
53
56
54
57
public sbyte inputHorizontal ;
55
58
public sbyte inputVertical ;
56
- public bool inputJump ;
57
59
public short pitch ;
58
60
public short yaw ;
59
61
62
+ public bool inputJump ;
63
+ public bool inputFire ;
64
+ public bool inputAim ;
65
+ public bool inputRun ;
66
+
60
67
public void setPitch ( float value )
61
68
{
62
69
pitch = ( short ) ( value * 10 ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ public class CharacterMovement : MonoBehaviour {
9
9
[ SerializeField ]
10
10
public float speed = 6.0F ;
11
11
[ SerializeField ]
12
+ public float runSpeed = 8.0F ;
13
+ [ SerializeField ]
12
14
public float jumpHeight = 8.0F ;
13
15
[ SerializeField ]
14
16
public float gravity = 20.0F ;
@@ -58,7 +60,12 @@ void SuperUpdate()
58
60
}
59
61
60
62
//Calculate movement from keys
61
- Vector3 movement = Vector3 . MoveTowards ( moveDirection , LocalMovement ( ) * speed , Mathf . Infinity ) ;
63
+ float actualSpeed = speed ;
64
+ if ( input . currentInput . inputRun )
65
+ {
66
+ actualSpeed = runSpeed ;
67
+ }
68
+ Vector3 movement = Vector3 . MoveTowards ( moveDirection , LocalMovement ( ) * actualSpeed , Mathf . Infinity ) ;
62
69
63
70
//Add jump velocity if jumping
64
71
if ( input . currentInput . inputJump && AcquiringGround ( ) )
Original file line number Diff line number Diff line change @@ -101,6 +101,22 @@ InputManager:
101
101
type : 0
102
102
axis : 0
103
103
joyNum : 11
104
+ - serializedVersion : 3
105
+ m_Name : Run
106
+ descriptiveName :
107
+ descriptiveNegativeName :
108
+ negativeButton :
109
+ positiveButton : right shift
110
+ altNegativeButton :
111
+ altPositiveButton : left shift
112
+ gravity : 1000
113
+ dead : .00100000005
114
+ sensitivity : 1000
115
+ snap : 0
116
+ invert : 0
117
+ type : 0
118
+ axis : 0
119
+ joyNum : 11
104
120
- serializedVersion : 3
105
121
m_Name : Mouse X
106
122
descriptiveName :
You can’t perform that action at this time.
0 commit comments