view Assets/Application/Scripts/InputManager.cs @ 13:e297afe0889d default tip

Add Prefab.
author Kazuma Takeda
date Tue, 07 Feb 2017 20:49: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);
	}
}