using UnityEngine;
using System.Collections;

public class PulseBehavior : MonoBehaviour {

	public float growSpeed = 0.125f;
	public float lifeTime = 0.0f;
	public float deathTime = 0.5f;
	public bool dies = true;

	public int pulseID = 1;

	GameObject player;

	// Use this for initialization
	void Start () {
		if (pulseID == 1)
			player = GameObject.FindGameObjectWithTag ("play1");
		else if (pulseID == 2)
			player = GameObject.FindGameObjectWithTag ("play2");
	}
	
	// Update is called once per frame
	void Update () {
		lifeTime += 1.0f * Time.deltaTime;
		this.gameObject.transform.position = player.transform.position;
		growSpeed = 0.5f * (Mathf.Pow (1.5f, (player.GetComponent<core> ().stage - 1)));
		transform.localScale += new Vector3 (growSpeed, growSpeed, growSpeed);
		
		if (lifeTime >= deathTime && dies) {
			Destroy(this.gameObject);		
		}
	}
}
