extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "tgheroes:nightwing/bluewing_layer1",
    "layer2": "tgheroes:nightwing/bluewing_layer2",
    "billy1": "tgheroes:nightwing/escrima",
	"billy2": "tgheroes:nightwing/escrima"
});

var utils = implement("fiskheroes:external/utils");

function initEffects(renderer) {	
	var model_billy1 = renderer.createResource("MODEL", "tgheroes:billy1");
    model_billy1.texture.set("billy1");
    billy1 = renderer.createEffect("fiskheroes:model").setModel(model_billy1);
    billy1.setScale(0.25);
	
	var model_billy2 = renderer.createResource("MODEL", "tgheroes:billy1");
    model_billy2.texture.set("billy2");
    billy2 = renderer.createEffect("fiskheroes:model").setModel(model_billy2);
    billy2.setScale(0.25);
	
}


function render(entity) {   
		if (entity.getData("fiskheroes:blade_timer") > 0.5) {
            var blade_anchor = billy1.anchor.set("rightArm");
            var blade_offSet = billy1.setOffset(1.0, 9.0, -6.0);
            var blade_rot = billy1.setRotation(90, 0, 0);
			billy1.anchor = blade_anchor, blade_offSet, blade_rot;
            billy1.render();
			
			var blade_anchor = billy2.anchor.set("leftArm");
            var blade_offSet = billy2.setOffset(0.0, 9.0, -6.0);
            var blade_rot = billy2.setRotation(90, 0, 0);
			billy2.anchor = blade_anchor, blade_offSet, blade_rot;
            billy2.render();
		} 	
		else {
			var blade_anchor = billy1.anchor.set("rightLeg");
            var blade_offSet = billy1.setOffset(3.0, 3.0, 0.0);
            var blade_rot = billy1.setRotation(180, 90, 0);
			billy1.anchor = blade_anchor, blade_offSet, blade_rot;
            billy1.render();
			
			var blade_anchor = billy2.anchor.set("rightLeg");
            var blade_offSet = billy2.setOffset(3.0, 3.0, -1.0);
            var blade_rot = billy2.setRotation(180, 90, 0);
			billy2.anchor = blade_anchor, blade_offSet, blade_rot;
            billy2.render();	
		}
}