0
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3
|
|
4 public class InputManager : MonoBehaviour { // Singleton
|
|
5 public static InputManager Instance;
|
|
6
|
|
7 public float InputX = 0f;
|
|
8 public float InputZ = 0f;
|
|
9 public bool ClickMouse = false;
|
3
|
10 public bool ClickSpace = false;
|
0
|
11
|
|
12 // Use this for initialization
|
|
13 void Start () {
|
|
14 if (Instance == null) {
|
|
15 Instance = this;
|
|
16 }
|
|
17 }
|
|
18
|
|
19 // Update is called once per frame
|
|
20 void Update () {
|
|
21 InputAxis ();
|
|
22 }
|
|
23
|
|
24 private void InputAxis () {
|
|
25 InputZ = Input.GetAxis ("Horizontal");
|
|
26 InputX = Input.GetAxis ("Vertical");
|
|
27 }
|
|
28
|
|
29 public bool InputMouseButton () {
|
|
30 return Input.GetMouseButton (0);
|
|
31 }
|
3
|
32
|
|
33 public bool InputSpace () {
|
|
34 return Input.GetKeyDown (KeyCode.Space);
|
|
35 }
|
0
|
36 }
|