using UnityEngine;
using System.Collections;

public class Flower_S : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		health += regenRate * Time.deltaTime;
		if(health > 10000){health = 10000;}
		References.Set("flower health", health);
		
	}
	
	
	void OnTriggerStay(Collider other) {
		other.gameObject.SendMessage("EnterFlower", this, SendMessageOptions.DontRequireReceiver);	
	}
	float health = 100f;
	float regenRate = 9f;
	
	public AudioClip smallHit;
	public AudioClip bigHit;
	
	public void TakeDamage(float damage){
		health -= damage;
		if(damage > 50){
			audio.clip = bigHit;
			audio.Play();
			audio.ignoreListenerVolume = true;
		}else{
			audio.clip = smallHit;
			audio.Play();
			audio.ignoreListenerVolume = false;
		}
		if(health < 0){
			GUIScript.Die();
		}
	}
	
}
