<commit_before>﻿using UnityEngine;
using System.Collections;

public class PlayerInput : MonoBehaviour {

	public string horizontalAxis="Horizontal";
	public string verticalAxis="Vertical";
	public string attackButton="Fire1";


	public float mouseSensitivity=3.0f;


	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetAxisRaw(horizontalAxis) < 0)
		{
			gameObject.SendMessage("MoveLeft");
		}
		else if (Input.GetAxisRaw(horizontalAxis) > 0)
		{
			gameObject.SendMessage("MoveRight");
		}
		else if (Input.GetAxisRaw(verticalAxis) < 0)
		{
			gameObject.SendMessage("MoveBackward");
		}
		else if (Input.GetAxisRaw(verticalAxis) > 0)
		{
			gameObject.SendMessage("MoveForward");
		}
		if (CursorLockMode.Locked == Cursor.lockState)
		{
			gameObject.SendMessage("SetRotation", Input.GetAxis("Mouse X")*mouseSensitivity);
		}

		if (Input.GetButtonDown(attackButton)) {
			gameObject.SendMessage("Attack");
		}
		
		if (Input.GetKeyDown(KeyCode.Escape))
		{
			SetCursorState(CursorLockMode.None);
		}
		else if (Input.touchCount > 0)
		{
			SetCursorState(CursorLockMode.Locked);
		}
	}
	void OnGUI()
	{
		if(CursorLockMode.Locked != Cursor.lockState)
		{
			GUI.Label(new Rect(Screen.width/2 - 75, Screen.height/2 - 15, 150, 30), "Game paused");
		}
	}
	private void SetCursorState(CursorLockMode lockState)
	{
		Cursor.lockState = lockState;
		// Hide cursor when locking
		Cursor.visible = (CursorLockMode.Locked != lockState);
	}

	void OnApplicationFocus(bool isFocused)
	{
		if(isFocused)
		{
			SetCursorState(CursorLockMode.Locked);
		}
	}
}<commit_msg>Added support for xbox360 controller in windows<commit_after>﻿using UnityEngine;
using System.Collections;

public class PlayerInput : MonoBehaviour {

    private const string horizontalAxis = "Horizontal";
    private const string verticalAxis = "Vertical";
    private const string attackButton = "Fire1";
    private const string cancelButton = "Cancel";
    private const string submitButton = "Submit";

    public float mouseSensitivity=3.0f;


	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetAxisRaw(horizontalAxis) < 0)
		{
			gameObject.SendMessage("MoveLeft");
		}
		else if (Input.GetAxisRaw(horizontalAxis) > 0)
		{
			gameObject.SendMessage("MoveRight");
		}
		else if (Input.GetAxisRaw(verticalAxis) < 0)
		{
			gameObject.SendMessage("MoveBackward");
		}
		else if (Input.GetAxisRaw(verticalAxis) > 0)
		{
			gameObject.SendMessage("MoveForward");
		}

		if (CursorLockMode.Locked == Cursor.lockState)
		{
			gameObject.SendMessage("SetRotation", Input.GetAxis("Mouse X") * mouseSensitivity);
		}

		if (Input.GetButtonDown(attackButton)) {
			gameObject.SendMessage("Attack");
		}
		
		if (Input.GetButtonDown(cancelButton))
		{
			SetCursorState(CursorLockMode.None);
		}
		else if (Input.touchCount > 0 || Input.GetButtonDown(submitButton))
		{
			SetCursorState(CursorLockMode.Locked);
		}
	}
	void OnGUI()
	{
		if(CursorLockMode.Locked != Cursor.lockState)
		{
			GUI.Label(new Rect(Screen.width/2 - 75, Screen.height/2 - 15, 150, 30), "Game paused");
		}
	}
	private void SetCursorState(CursorLockMode lockState)
	{
		Cursor.lockState = lockState;
		// Hide cursor when locking
		Cursor.visible = (CursorLockMode.Locked != lockState);
	}

	void OnApplicationFocus(bool isFocused)
	{
		if(isFocused)
		{
			SetCursorState(CursorLockMode.Locked);
		}
	}
}
{'fraction_non_alphanumeric': 0.1226009739329705, 'fraction_numerical': 0.011744485820681752, 'mean_word_length': 4.075581395348837, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4485454', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1141, 'n_words': 226}