view Assets/Application/Scripts/InputManager.cs @ 3:2dd40b4412e4

Create game base.
author Kazuma
date Mon, 07 Nov 2016 18:42:01 +0900
parents e5ef0342d00b
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);
	}
}