﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class oscilation : MonoBehaviour {

	public float m_speed = 0.008f;
	public int m_distance = 45;
	private int compteur = 0;
	private int compteur2 = 0;
	// Use this for initialization
	void Start () {
		Vector3 yOrigin = transform.localPosition;
		/*Vector3 move = new Vector3(0.0f,0.0f,0.0f);
		Vector3 move2 = new Vector3(0.0f,0.0f,0.0f);
		move.y = m_speed;
		move2.y = -m_speed;*/
	}





	// Update is called once per frame
	void Update () {
		
		if (compteur < m_distance) {
			Vector3 move = new Vector3(0.0f,0.0f,0.0f);
			move.y = m_speed;
			transform.localPosition = transform.localPosition + move;
			compteur++;
		} else if (compteur2 < m_distance) {
			Vector3 move2 = new Vector3(0.0f,0.0f,0.0f);
			move2.y = -m_speed;
			compteur2++;
			transform.localPosition = transform.localPosition + move2;
		} else {
			compteur = 0;
			compteur2 = 0;
		}




	}
}
