package projectzombie.tiles;

import gl_engine.vec.Vec2i;
import projectzombie.Main;
import projectzombie.entity.Entity;
import projectzombie.entity.player.EntityPlayer;
import projectzombie.init.Models;
import projectzombie.model.Model;
import projectzombie.task.TaskLadderUp;
import projectzombie.util.TileState;
import projectzombie.world.layer.Layer;

public class TileLadderUp extends Tile
{
	public TileLadderUp() {
		
		this.tileSolid = true;
		this.tileHitbox = 0.3;
		this.unbreakable = true;
	}
	
	@Override
	public boolean onActivated(Layer layer, Vec2i pos, Entity entity, TileState state)
	{
		// Call super
		super.onActivated(layer, pos, entity, state);
		
		// Is the entity the player
		if(entity == Main.player)
		{
			// Cast to player
			EntityPlayer player = (EntityPlayer)entity;
			if(player.in_animation) return true;
			
			player.addTask(new TaskLadderUp(player, state.meta));
		}
		
		return true;
	}
	
	@Override
	public Model getModel(byte meta) {
		return Models.TILE_LADDER_UP;
	}

}
