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

[RequireComponent(typeof(FPSInputController))]
[RequireComponent(typeof(AudioSource))]
[RequireComponent(typeof(CharacterController))]
public class Movement : MonoBehaviour {

	/// <summary>
	/// The step sound to be played. Must be loopeable.
	/// </summary>
	public AudioClip[] stepSounds;
	public AudioClip[] runningStepSounds;

	/// <summary>
	/// The time the human can run in seconds.
	/// </summary>
	public float sprintTime = 7;
	
	/// <summary>
	/// The sprint speed.
	/// </summary>
	public float sprintSpeed = 10;
	
	/// <summary>
	/// The regen rate.
	/// </summary>
	public float regenRate = 1.5f;

	/// <summary>
	/// The time needed to recover between sprints.
	/// </summary>
	public float restTime = 10;

	public float maximumFieldOfView;

	private float initialFieldOfView, currentFieldOfView;

	private float sprintTimeLeft;

	private float defaultSpeed;

	private bool canRun;

	private float timeRested;

	private bool frozen;

	//the one in charge of the character movement
	private CharacterMotor motor;

    //TODO: Delete this variables that 
	private float stepTimer;
	public float timeBetweenSteps = 1;

	void Start () {
		initialFieldOfView = currentFieldOfView = Camera.main.fieldOfView;
		if(stepSounds == null || stepSounds.Length==0){
			Debug.LogError("StepSoundPlayer: step sound not asigned to object " + gameObject.name);
		}
		sprintTimeLeft = sprintTime;
		motor = GetComponent<CharacterMotor>();
		defaultSpeed = motor.movement.maxForwardSpeed;
		canRun = true;
		timeRested = 0;
		stepTimer = timeBetweenSteps;
		frozen = false;
	}

	void Update () {
		if(!frozen){
        	Run();
		}
        Debug.Log(motor.GetVelocity());
	}

    /// <summary>
    /// Checks if the player is able to run in a given moment, if so,
    /// changes the speed used by the CharacterMotor component.
    /// If the player runs a given amount of time, he must rest before
    /// running again.
    /// </summary>
    private void Run() {
		bool running = Input.GetAxis("Sprint") > 0;
		bool walking = false;
        //TODO: Delete this line, this line is necessary because we don't have the animation yet.
        if ((Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0))
        {
			walking = true;
			if(stepTimer >= timeBetweenSteps){<commit_msg>No se pudo muchachos. (que el volumen de los pasos aumente acorde a la velocidad)<commit_after>﻿using UnityEngine;
using System.Collections;

[RequireComponent(typeof(FPSInputController))]
[RequireComponent(typeof(AudioSource))]
[RequireComponent(typeof(CharacterController))]
public class Movement : MonoBehaviour {

	/// <summary>
	/// The step sound to be played. Must be loopeable.
	/// </summary>
	public AudioClip[] stepSounds;
	public AudioClip[] runningStepSounds;

	/// <summary>
	/// The time the human can run in seconds.
	/// </summary>
	public float sprintTime = 7;
	
	/// <summary>
	/// The sprint speed.
	/// </summary>
	public float sprintSpeed = 10;
	
	/// <summary>
	/// The regen rate.
	/// </summary>
	public float regenRate = 1.5f;

	/// <summary>
	/// The time needed to recover between sprints.
	/// </summary>
	public float restTime = 10;

	public float maximumFieldOfView;

	private float initialFieldOfView, currentFieldOfView;

	private float sprintTimeLeft;

	private float defaultSpeed;

	private bool canRun;

	private float timeRested;

	private bool frozen;

	//the one in charge of the character movement
	private CharacterMotor motor;

    //TODO: Delete this variables that 
	private float stepTimer;
	public float timeBetweenSteps = 1;

	void Start () {
		initialFieldOfView = currentFieldOfView = Camera.main.fieldOfView;
		if(stepSounds == null || stepSounds.Length==0){
			Debug.LogError("StepSoundPlayer: step sound not asigned to object " + gameObject.name);
		}
		sprintTimeLeft = sprintTime;
		motor = GetComponent<CharacterMotor>();
		defaultSpeed = motor.movement.maxForwardSpeed;
		canRun = true;
		timeRested = 0;
		stepTimer = timeBetweenSteps;
		frozen = false;
	}

	void Update () {
		if(!frozen){
        	Run();
		}
        //TODO: el volumen de los pasos debe ser mayor o menor dependiendo de la velocidad del jugador.
        //Debug.Log(motor.GetVelocity().magnitude);
	}

    /// <summary>
    /// Checks if the player is able to run in a given moment, if so,
    /// changes the speed used by the CharacterMotor component.
    /// If the player runs a given amount of time, he must rest before
    /// running again.
    /// </summary>
    private void Run() {
		bool running = Input.GetAxis("Sprint") > 0;
		bool walking = false;
        //TODO: Delete this line, this line is necessary because we don't have the animation yet.
        if ((Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0))
        {
			walking = true;
			if(stepTimer >= timeBetweenSteps){
{'fraction_non_alphanumeric': 0.11588861588861589, 'fraction_numerical': 0.005323505323505323, 'mean_word_length': 3.2663755458515285, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, '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': '2253459', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1434, 'n_words': 482}