using UnityEngine;
using System.Collections;

public class FlameManager : MonoBehaviour {
	public float duration =1;
	Transform tran;
	public float size = 0.8f;
	Vector3 smallerScale;
	Vector3 normalScale;
	public float n = .97f;
	public float o = .03f;
	float timer=0;
	public bool manager;
	Vector3 old;
	// Use this for initialization
	void Start () {
		normalScale = transform.localScale;
		smallerScale = transform.localScale * size;

		manager = true;
	}
	
	// Update is called once per frame
	void Update () {
		timer += Time.deltaTime;
		if (timer >= duration && manager) {
			old = smallerScale;
			manager = false;
			timer = 0;
		}
		if (timer >= duration && !manager){
			old = normalScale;

			manager = true;
			timer = 0;
		}
		Vector3 p = transform.localScale;

		transform.localScale = new Vector3 (p.x * n + old.x * o, p.y *n + old.y * o, p.z * n + old.z * o);
	}
}

