package Ship;

import java.util.ArrayList;
import java.util.List;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode;
import com.jln.ld.GameAnimation;
import com.jln.ld.GameUtils;
import com.jln.ld.Shared;

import menus.GameMenu;
import shoot.HunterShoot;

public class Hunter02 extends Hunter01{

	protected int cpt=0;
	
	public Hunter02(float x, float y, boolean playerOnControl) {
		super(x, y, playerOnControl);
		this.speed = 3.7f;
		this.speedFactor = 0f;
		this.acceleration = 0.05f;
		this.energy = 300;
		this.energy = maxEnergy;
		
	}
	
	@Override
	protected void initRessources(){
		this.moveAnimations = new Animation[6];
		moveAnimations[0] = GameUtils.loadAnimation(Shared.SHIP_HUNTER2, 3, 0, 0.12f, PlayMode.LOOP);
		moveAnimations[1] = GameUtils.loadAnimation(Shared.SHIP_HUNTER2, 3, 1, 0.12f, PlayMode.LOOP);
		moveAnimations[2] = GameUtils.loadAnimation(Shared.SHIP_HUNTER2, 3, 2, 0.12f, PlayMode.LOOP);
		moveAnimations[3] = GameUtils.loadAnimation(Shared.SHIP_HUNTER2, 3, 3, 0.12f, PlayMode.LOOP);
		moveAnimations[4] = GameUtils.loadAnimation(Shared.SHIP_HUNTER2, 3, 4, 0.12f, PlayMode.LOOP);
		moveAnimations[5] = GameUtils.loadAnimation(Shared.SHIP_HUNTER2, 3, 5, 0.12f, PlayMode.LOOP);
		
		warning1 = GameUtils.loadAnimation(Shared.ANIM_WARNING, 12, 0, 0.08f,  PlayMode.LOOP);
		warning2 = GameUtils.loadAnimation(Shared.ANIM_WARNING, 12, 1, 0.08f,  PlayMode.LOOP);
	}

	protected List<HunterShoot> createShoot(){
		List<HunterShoot> shoots = new ArrayList<>();
		if(shootLevel == 0 || shootLevel == 2 || shootLevel == 3){
			shoots.add(new HunterShoot(x+14, y, 7, 0,true));
		}
		if(shootLevel == 1 || shootLevel == 2){
			shoots.add(new HunterShoot(x+6, y+14, 6.6f, 0.4f,true));
			shoots.add(new HunterShoot(x+6, y-14, 6.6f, -0.4f,true));
		}
		if(shootLevel == 3){
			shoots.add(new HunterShoot(x+6, y+12, 6.6f, 0.4f,true));
			shoots.add(new HunterShoot(x+6, y-12, 6.6f, -0.4f,true));
			shoots.add(new HunterShoot(x+7, y+17, 6.1f, 0.9f,true));
			shoots.add(new HunterShoot(x+7, y-17, 6.1f, -0.9f,true));
		}
		return shoots;
	}
	
	protected void playShootSound(){
		Shared.SOUND_LASER_3.play(playerOnControl?0.7f:0.5f);
	}
	
	protected void addMoveAnimation(GameMenu game){
		game.getAnimations().add(new GameAnimation(GameAnimation.ANIM_DESTROYER_HUNTER02_MOVE,x-16,y));
	}
}
