Mercurial > hg > Members > kazuma > JungleforUnity
view Assets/Application/Scripts/InputManager.cs @ 10:3fefb9f9025d
put Attribute class.
author | Kazuma Takeda |
---|---|
date | Fri, 20 Jan 2017 07:30:26 +0900 |
parents | 2dd40b4412e4 |
children |
line wrap: on
line source
using UnityEngine; using System.Collections; public class InputManager : MonoBehaviour { // Singleton public static InputManager Instance; public float InputX = 0f; public float InputZ = 0f; public bool ClickMouse = false; public bool ClickSpace = false; // Use this for initialization void Start () { if (Instance == null) { Instance = this; } } // Update is called once per frame void Update () { InputAxis (); } private void InputAxis () { InputZ = Input.GetAxis ("Horizontal"); InputX = Input.GetAxis ("Vertical"); } public bool InputMouseButton () { return Input.GetMouseButton (0); } public bool InputSpace () { return Input.GetKeyDown (KeyCode.Space); } }