extend("fiskheroes:hero_basic");
loadTextures({
	"layer1": "tgheroes:titan/titan_layer1",
	"layer2": "tgheroes:titan/titan_layer2",
	"sword": "tgheroes:guardians/thanos_sword"
});

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

function initEffects(renderer) {
	
    var model_sword = renderer.createResource("MODEL", "tgheroes:thanossword");
    model_sword.texture.set("sword");
    model_sword.generateMirror();

    sword = renderer.createEffect("fiskheroes:model").setModel(model_sword);
    sword.anchor.set("rightArm");
    sword.setScale(1);

	var model_back1 = renderer.createResource("MODEL", "tgheroes:thanossword");
    model_back1.texture.set("sword");

    back1 = renderer.createEffect("fiskheroes:model").setModel(model_back1);
    back1.setScale(1);	
	
}


function render(entity, renderLayer, isFirstPersonArm) {

    if (renderLayer == "CHESTPLATE") {
        if (entity.getData("fiskheroes:blade_timer") > 0.3) {
            var blade_anchor = sword.anchor.set("rightArm");
            var blade_offSet = sword.setOffset(1.0, 8.0, -3.5);
            var blade_rot = sword.setRotation(90, 90, 0);
          
  
            sword.anchor = blade_anchor, blade_offSet, blade_rot;
            sword.render();
        }
        else {
            var back_anchor = back1.anchor.set("body");
            var back_offSet = back1.setOffset(0.0, 8.0, 3.0);
            var back_rot = back1.setRotation(0, 0, 140);
            back1.anchor = back_anchor, back_offSet, back_rot;
            back1.render();
        }

    }
}
