using UnityEngine;
using System.Collections;

public class Inputs : MonoBehaviour {

	public static bool m_bLeftJustPressed;
	public static bool m_bLeftPressed;
	public static bool m_bRightJustPressed;
	public static bool m_bRightPressed;

	public static bool m_bUpJustPressed;
	public static bool m_bUpPressed;
	public static bool m_bDownJustPressed;
	public static bool m_bDownPressed;

	public static bool m_bLTIsJustPressed;
	public static bool m_bLTIsPressed;

	public static bool m_bRTIsJustPressed;
	public static bool m_bRTIsPressed;


	// Use this for initialization
	void Start () {
		m_bLeftJustPressed = false;	
		m_bLeftPressed = false;
		m_bRightJustPressed = false;
		m_bRightPressed = false;
		m_bUpJustPressed = false;
		m_bUpPressed = false;
		m_bDownJustPressed = false;
		m_bDownPressed = false;
	}
	
	// Update is called once per frame
	void Update () 
	{


		if( GameStateManager.m_Instance && GameStateManager.m_Instance.m_eGameState == GlobalVars.GAME_STATE.GAME_OVER )
			return;

		m_bLTIsJustPressed = false;
		if( Input.GetAxis("LT") > 0)
		{
			if( !m_bLTIsPressed )
			{
				m_bLTIsJustPressed = true;
			}
			m_bLTIsPressed = true;
		}
		else
		{
			m_bLTIsPressed = false;
		}

		m_bRTIsJustPressed = false;
		if( Input.GetAxis("RT") > 0)
		{
			if( !m_bRTIsPressed )
			{
				m_bRTIsJustPressed = true;
			}
			m_bRTIsPressed = true;
		}
		else
		{
			m_bRTIsPressed = false;
		}


		m_bLeftJustPressed = false;
		if( Input.GetAxis("Horizontal") < 0)
		{
			if( !m_bLeftPressed )
			{
				m_bLeftJustPressed = true;
			}
			m_bLeftPressed = true;
		}
		else
		{
			m_bLeftPressed = false;
		}

		m_bRightJustPressed = false;
		if( Input.GetAxis("Horizontal") > 0)
		{
			if( !m_bRightPressed )
			{
				m_bRightJustPressed = true;
			}
			m_bRightPressed = true;
		}
		else
		{
			m_bRightPressed = false;
		}	

		m_bUpJustPressed = false;
		if( Input.GetAxis("Vertical") > 0)
		{
			if( !m_bUpPressed )
			{
				m_bUpJustPressed = true;
			}
			m_bUpPressed = true;
		}
		else
		{
			m_bUpPressed = false;
		}
		
		m_bDownJustPressed = false;
		if( Input.GetAxis("Vertical") < 0)
		{
			if( !m_bDownPressed )
			{
				m_bDownJustPressed = true;
			}
			m_bDownPressed = true;
		}
		else
		{
			m_bDownPressed = false;
		}
	}
}
