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

public class FloatingScript : MonoBehaviour
{
    // Start is called before the first frame update
    public float floatingHeight = 0.5f;
    private int count = 0;
    private const int STEPS = 25;
    private bool up = true;

    void FixedUpdate()
    {
        Vector3 move = new Vector3();
        if (up)
        {
            move = new Vector3(0f, floatingHeight / STEPS, 0f);
        }
        else
        {
            move = new Vector3(0f, -floatingHeight / STEPS, 0f);
        }

        transform.position += move;
        count ++;

        if (count == STEPS)
        { 
            count = 0;
            up = !up;
        }
    }
}
