package gameObjects;
/*
 * Created on Sep 20, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */

/**
 * @author tamer
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */

public class Player extends GameObject implements AbsPosSettable{
	public final static int TEAM_OPPONENT = 1;
	public final static int TEAM_WE = -1;
	public final static int TEAM_UNKNOWN = 0;
	private float bodyDir;
	private float headDir;
	private int team;
	private int unum; 
	private int mode;
	
	
    public static final int TOUCHED_PLAYER = 0;
    public static final int INVISIBLE_PLAYER = 1;
    public static final int TEAM_PLAYER = 2;
    public static final int UNUM_PLAYER = 3;
	
	//	((p "verlierer" 1) 20.1 0 0 0 0 0);((p "verlierer") 49.4 0);((p) 66.7 0)
		
		public Player(float dist, float dir, int time, int mode){			
			super(dist, dir, time);
			this.team = TEAM_UNKNOWN;
			this.mode = mode;
		}
		
		public Player(int team, float dist, float dir, int time, int mode){
			super(dist, dir, time);
			this.team = team;
			this.mode = mode;
		}
		
		public Player(int team, int unum, float dist, float dir, float distChange, float dirChange, float bodyDir, float headDir, int time, int mode){
			super(dist, dir, distChange, dirChange, time);
			this.team = team;
			this.unum = unum;
			this.bodyDir = bodyDir;
			this.headDir = headDir;
			this.mode = mode;
		}


	public float getBodyDir() throws ObjectInvisibleException{
		if (!super.isSeen()) throw new ObjectInvisibleException("BodyDirection nicht sichtbar!");
		return bodyDir;
	}


	public float getHeadDir() throws ObjectInvisibleException{
		if (!super.isSeen()) throw new ObjectInvisibleException("HeadDirection nicht sichtbar!");
		return headDir;
	}

	/**
	 * Die Teamnummer des Teams, zu dem der Spieler geh?rt
	 * @return TEAM_OPPONENT, TEAM_WE oder TEAM_UNKNOWN
	 */
	public int getTeam() {
		return team;
	}


	public int getUnum() throws ObjectInvisibleException{
		if (!super.isSeen()) throw new ObjectInvisibleException("Unum nicht sichtbar!");
		return unum;
	}

	/**
	 * @param i
	 */
	public void setAbsX(double i) {
		super.setAbsX(i);
	}

	/**
	 * @param i
	 */
	public void setAbsY(double i) {
		super.setAbsY(i);
	}
	
	/**
	 * TouchedPlayer 0	
		InvisiblePlayer 1
		TeamPlayer 2
		UnumPlayer 3
	 */
	public int getMode() {
		return mode;
	}

	public String toString(){
	     String returnString =
            "Player (x: " + super.getAbsX() 
            + ", y: " + super.getAbsY()
        	+ ", dist: "+ super.getDist()
        	+ ", dir: " + super.getDir()
        	+ ", unum: " + unum
        	+ ", zuletzt gesehen: " + super.getLastSeenTime()
        	+ ", mode: " + mode + ")";
	     	
	     
	     return returnString;
	}
	
}
