//private var isRunning : boolean = false;
var runSpeed = 2.0;
//var bobbingAmount = 0.05;

private var walker : CharacterMotor;
private var HeadUp : HeadbobberGun;
private var walkerwalkSpeed = 0.0;
private var OrigHeadUpSpeed = 0.0;

function Start () {
	walker = GetComponent(CharacterMotor);
	walkerwalkSpeed = walker.movement.maxForwardSpeed;
	
	HeadUp = this.gameObject.GetComponentInChildren(HeadbobberGun);
	OrigHeadUpSpeed = HeadUp.bobbingSpeed;
}

function ActivarArma () {
	HeadUp = this.gameObject.GetComponentInChildren(HeadbobberGun);
	OrigHeadUpSpeed = HeadUp.bobbingSpeed;
}



function Update () {
	if(Input.GetButton ("Run") && !FPCStatus.isRunning && !FPCStatus.isCrouched && !FPCStatus.IsAiming){
		walker.movement.maxForwardSpeed = runSpeed;
		walker.movement.maxSidewaysSpeed = runSpeed;
		walker.movement.maxBackwardsSpeed = runSpeed;
		HeadUp.bobbingSpeed =  HeadUp.bobbingRunSpeed;
		FPCStatus.isRunning = true;
		FPCStatus.isRunningAntFrame = false;
	}
	else
	if(Input.GetButtonUp ("Run") && FPCStatus.isRunning){
		var walkAux : float = walkerwalkSpeed;
		if(FPCStatus.isCrouched)
			walkAux = 2;
		walker.movement.maxForwardSpeed = walkAux;
		walker.movement.maxSidewaysSpeed = walkAux;
		walker.movement.maxBackwardsSpeed = walkAux;
		HeadUp.bobbingSpeed =  OrigHeadUpSpeed;
		FPCStatus.isRunning = false;
		FPCStatus.isRunningAntFrame = true;
	}
}	
	
   