using UnityEngine;
using System.Collections;

public class DPadButtonController : MonoBehaviour {

	public Vector3 Axis {
		get { return axis;}
	}
	private Vector3 axis;
	private float axisHorizontal, axisVertical;


	private bool leftPressed,rightPressed,topPressed,bottomPressed;



	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (leftPressed || rightPressed || topPressed || bottomPressed) {
			axis = new Vector3 (axisHorizontal, axisVertical);

		} else {
			axis = Vector3.zero;
		}


	}


	public void LeftButtonPressed() {
		leftPressed = true;
		axisHorizontal = -1;
	}

	public void LeftButtonReleased() {
		leftPressed = false;
		axisHorizontal = 0;
	}

	public void RightButtonPressed() {
		rightPressed = true;
		axisHorizontal = 1;
	}

	public void RightButtonReleased() {
		rightPressed = false;
		axisHorizontal = 0;
	}


	public void TopButtonPressed() {
		topPressed = true;
		axisVertical = 1;
	}

	public void TopButtonReleased() {
		topPressed = false;
		axisVertical = 0;
	}

	public void BottomButtonPressed() {
		bottomPressed = true;
		axisVertical = -1;
	}

	public void BottomButtonReleased() {
		bottomPressed = false;
		axisVertical = 0;
	}


}
