package game;

import framework.animation.Animation3D;
import framework.gameMain.Movable;
import framework.gameMain.OvergroundActor;
import framework.model3D.BaseObject3D;
import framework.model3D.Object3D;
import framework.model3D.Placeable;
import framework.model3D.Position3D;
import framework.model3D.Quaternion3D;
import framework.physics.Ground;
import framework.physics.Solid3D;
import framework.physics.Velocity3D;
import java3d.Appearance;
import java3d.Box;
import java3d.Material;
import java3d.TransformGroup;

public class Mirror extends Entity implements Item {

	OvergroundActor actor;
	double angle;
	String state;	//　pre = 位置決定済・角度調整中　: on = 設置完了・使用可能状態
	
	String sId;
	
	int startTime = 0;	//0はstartTime未設定状態
	
	public Mirror(double x, double y, double z, double angle, String state, String sId) {

		actor.setPosition(new Position3D(x,y,z));
		
		this.angle = angle;
		this.state = state;
		
		this.sId = sId;
		
		//鏡生成
		Appearance ap1 = new Appearance();
		Material color = new Material();
		color.setEmissiveColor(0.0f, 0.5f, 1.0f);
		ap1.setMaterial(color);

		//鏡の大きさ
		Box b1 = new Box(8.0f, 8.0f, 0.1f, ap1);
		Object3D ob1 = new Object3D("Mirror", b1);
		
		//鏡の配置
		ob1.apply(new Position3D(x, y, z), false);

		Solid3D Mirror = new Solid3D(ob1);
		Mirror.scale(2.0, 2.0, 2.0);
				
		actor = new OvergroundActor(Mirror,null);
	}
	
	//angle
	public double getAngle() {
		return angle; //1117
	}
	public void setAngle(double angle) {
		this.angle = angle;
	}
	
	//state
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;		
	}
	
	//sId
	public String getsId() {
		return sId;
	}
	
	//startTime
	public void setStartTime(int countTime) {
		startTime = countTime;
	}
	public int getStartTime() {
		return startTime;
	}
	
	//X座標を取得
	public double getX(){
		return ((Object3D)actor.getBody()).getPosition3D().getX();
	}
	
	//Y座標を取得
	public double getY(){
		return ((Object3D)actor.getBody()).getPosition3D().getY();
	}
	
	//Z座標を取得
	public double getZ(){
		return ((Object3D)actor.getBody()).getPosition3D().getZ();
	}
	
	public void setPoint(double x, double y, double z) {
		actor.setPosition(new Position3D(x,y,z));
	}
	
	@Override
	public TransformGroup getTransformGroupToPlace() {
		return actor.getTransformGroupToPlace();
	}

	@Override
	public BaseObject3D getBody() {
		return actor.getBody();
	}
}