using UnityEngine;
using System.Collections;

public class SlugAnim : MonoBehaviour {

	public float Timer;
	public float Speed;

	private float counter;
	private int direction = 1;

	// Use this for initialization
	void Start () {
		counter = Timer;
	}
	
	// Update is called once per frame
	void Update () {
		counter -= Time.deltaTime;
		if (counter <= 0){
			direction *= -1;
			counter = Timer;
		}
		var newScale = new Vector3(this.transform.localScale.x + Speed * direction / 2, 1, this.transform.localScale.x + Speed * direction);
		this.transform.localScale = newScale;

	}
}
