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;
|
|
10
|
|
11 // Use this for initialization
|
|
12 void Start () {
|
|
13 if (Instance == null) {
|
|
14 Instance = this;
|
|
15 }
|
|
16 }
|
|
17
|
|
18 // Update is called once per frame
|
|
19 void Update () {
|
|
20 InputAxis ();
|
|
21 }
|
|
22
|
|
23 private void InputAxis () {
|
|
24 InputZ = Input.GetAxis ("Horizontal");
|
|
25 InputX = Input.GetAxis ("Vertical");
|
|
26 }
|
|
27
|
|
28 public bool InputMouseButton () {
|
|
29 return Input.GetMouseButton (0);
|
|
30 }
|
|
31 }
|