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

public class CameraView : MonoBehaviour
{
    public Transform player;
    public Vector3 offset;
    public float walk;
    public float limit;
    private float init;

    private void Start()
    {
        init = offset.y;
    }
    // Update is called once per frame
    void Update()
    {    
        transform.position = player.position + offset;

        
    }

    private void FixedUpdate()
    {
        if (offset.y <= init || offset.y >= limit)
        {
            walk *= -1;
        }
        if(Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0)
        {
            offset.y += walk;
        }
    }

}
