using UnityEngine;
using System.Collections;

public class SlugWalker : MonoBehaviour {

	private float growTime = 0.5f;

	private float growSize = 1.3f;

	private float timeLeft = 0.0f;

	void Start() {
		timeLeft = Random.Range (0.0f, growTime * 2.0f);
	}
	
	// Update is called once per frame
	void Update () {
		float size  = 1.0f;
		if (timeLeft > growTime) size = Mathf.Lerp (1.0f, growSize, (timeLeft - growTime) / growTime);
		else size = Mathf.Lerp (growSize, 1.0f, (timeLeft) / growTime);
		transform.localScale = new Vector3(size, size, 1.0f);
		if (timeLeft <= 0.0f) {
			timeLeft += growTime * 2.0f;
		}
		timeLeft -= Time.deltaTime;
	}
}
