

function JumpAction(character){
	this.name = "jump";
	this.character = character;
	this.animation = character.animations["jump"];
	this.relations = new Array();
	this.age = 0;
	this.speedVector = null;
}

JumpAction.prototype.update = function(time){
	this.animation.addTime(time);
	
	//logDebug(this.speedVector.toString());
	
	//logDebug(this.speedVector.toString() + " + " + this.character.position.toString() + " = " + vec.toString());
	this.character.position = this.character.position.addVector(this.speedVector.mulScalar(time*30));
	this.character.position.y = Math.max(this.character.position.y, 0);
	this.speedVector.y -= time * 60;
	
	//logDebug(this.character.position.z);
	
	for(var i = 0; i < this.relations.length; i++){
		var rel = this.relations[i];
		var res = rel.condition();
		if(res){
			return rel.targetAction;
		}
	}
	
	this.age += time;
	return this;
}

JumpAction.prototype.setTime = function(time){
	this.age = time;
	this.animation.setTime(time);
}


