1
1
using System . Collections ;
2
2
using System . Collections . Generic ;
3
3
using UnityEngine ;
4
+ using UnityEngine . UIElements ;
4
5
5
6
public class Fly : MonoBehaviour
6
7
{
@@ -9,10 +10,24 @@ public class Fly : MonoBehaviour
9
10
10
11
void Update ( )
11
12
{
12
- float translateX = Input . GetAxis ( "Horizontal" ) * speed ;
13
- float translateY = Input . GetAxis ( "VerticalY" ) * speed ;
14
- float translateZ = Input . GetAxis ( "Vertical" ) * speed ;
13
+ RotateHandler ( ) ;
14
+ }
15
+
16
+ public void TranslateHandler ( )
17
+ {
18
+ float translateX = Input . GetAxis ( "Horizontal" ) * speed ;
19
+ float translateY = Input . GetAxis ( "VerticalY" ) * speed ;
20
+ float translateZ = Input . GetAxis ( "Vertical" ) * speed ;
15
21
16
22
transform . Translate ( new Vector3 ( translateX , translateY , translateZ ) ) ;
17
23
}
24
+
25
+ public void RotateHandler ( )
26
+ {
27
+ float rotationX = Input . GetAxis ( "Vertical" ) * speed ;
28
+ float rotationY = Input . GetAxis ( "Horizontal" ) * speed ;
29
+ float rotationZ = Input . GetAxis ( "HorizontalZ" ) * speed ;
30
+
31
+ transform . Rotate ( rotationX , rotationY , rotationZ ) ;
32
+ }
18
33
}
0 commit comments