// SpeechBubble.prototype = Object.create(Phaser.Text.prototype);
// SpeechBubble.prototype.constructor = SpeechBubble;

SpeechBubble = function(x, y) {
	var textStyle = { font: "normal 24px Arial", fill: "#ff0", boundsAlignH: "center", boundsAlignV: "middle" };

	this.speechBubbleText = game.add.text(0, 0, "맛없어!!!", textStyle);
	this.speechBubbleText.addColor("#f00", 0);
	this.speechBubbleText.anchor.setTo(0.5, 0.4);
	this.speechBubbleText.scale.set(1.7);

	this.speechBubble = game.add.image(x, y, 'speech_bubble_angry');
	this.speechBubble.addChild(this.speechBubbleText);
	this.speechBubble.anchor.set(0.5);
	this.speechBubble.scale.set(0.7);
	this.speechBubble.inputEnabled = false;
}

SpeechBubble.prototype.update = function() {
	this.y -= 0.3;
}

SpeechBubble.prototype.showSpeechBubble = function(type) {
	if(type == Meat.DONENESS_WELLDONE) {
		this.speechBubbleText.addColor("#33f", 0);
		this.speechBubble.loadTexture('speech_bubble_happy');
		this.speechBubbleText.text = "맛있어 ♥♡♥";
	} else {
		this.speechBubble.loadTexture('speech_bubble_angry');

		if(type == Meat.DONENESS_RARE) {
			this.speechBubbleText.addColor("#f33", 0);
			this.speechBubbleText.text = "날고기 싫어!!!";
		} else if(type == Meat.DONENESS_BURN_BLACK) {
			this.speechBubbleText.addColor("#333", 0);
			this.speechBubbleText.text = "탄 고기\n안먹을래!!!";
		}
	}

	this.speechBubble.alpha = 1;
	game.time.events.add(Phaser.Timer.SECOND * 1, this.hideSpeechBubble, this);
},

SpeechBubble.prototype.hideSpeechBubble = function() {
	this.speechBubble.alpha = 0;
},

SpeechBubble.prototype.destroySelf = function() {
	this.destroy();
}


