package entities;

import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.camera.hud.HUD;
import org.anddev.andengine.entity.text.ChangeableText;
import org.anddev.andengine.opengl.font.Font;

/** HUD class for showing both score and time in the camera space **/

public class ScoreHUD extends HUD{
	
	 
	          private long score = 0;
	          private long time = 0;
	          
	          
	          private final ChangeableText ScoreText;
	          private final ChangeableText TimeText;
	          
	       
	   
	       
	   
	          public ScoreHUD(Font pFont, final Camera pCamera) {
	   
	              ScoreText = new ChangeableText(- 95, -10, pFont, "Score : 0123456789");		             
	              ScoreText.setScale(0.3f);
	              ScoreText.setText("Score : " + score);
	              
	              TimeText = new ChangeableText(190 , -10 , pFont, "Time : 0123456789");
	              TimeText.setScale(0.3f);
	              TimeText.setText("Score : " + time);
	   
	              this.getTopLayer().addEntity(ScoreText);
	              this.getTopLayer().addEntity(TimeText);
	   
	          }
	          
	          //Get and Set
	          
	          public void addScore(int pScore){
	        	  this.score = this.score + pScore;	        	  
	        	  ScoreText.setText("Score : " + score);
	        	
	          }
	          
	          
	          public void addTime(int pTime){
	        	  this.time = this.time + pTime;          	  
	        	  TimeText.setText("Time : " + time);
	        	
	          }
	          
	          public void resetHUD(){
	        	  this.time = 0;
	        	  this.score = 0;
	        	  ScoreText.setText("Score : " + score);
	        	  TimeText.setText("Time : " + time);
	          }
	          
	          public long getScore(){
	        	  return this.score;
	          }
	          
	          public long getTime(){
	        	  return this.time;
	          }
	          
	                 
	  
}
