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

public class SineMotion : MonoBehaviour
{
    public float amplitudeX = 2.0f;
    public float omegaX = 1.0f;
    float index;

    public void Update()
    {
        index += Time.deltaTime;
        SetX(amplitudeX * Mathf.Sin(omegaX * index));
    }

    public void SetX(float x)
    {
        Vector2 pos = transform.localPosition;
        pos.x = x;
        transform.localPosition = pos;
    }
}
