using UnityEngine;

public class CameraMovement : MonoBehaviour
{
    public int speed = 10;

    public bool moveLeft = false;
    public bool moveRight = false;
    public bool moveUp = false;
    public bool moveDown = false;

    public bool zoomIn = false;
    public bool zoomOut = false;

    private void FixedUpdate()
    {
        if(moveLeft) transform.Translate(new Vector2(-speed * Time.deltaTime, 0));
        if (moveRight) transform.Translate(new Vector2(speed * Time.deltaTime, 0));
        if (moveUp) transform.Translate(new Vector2(0, speed * Time.deltaTime));
        if (moveDown) transform.Translate(new Vector2(0, -speed * Time.deltaTime));

        if (zoomIn) gameObject.GetComponent<Camera>().orthographicSize--;
        if (zoomOut) gameObject.GetComponent<Camera>().orthographicSize++;
    }

    // Controller access
    public void actionMoveLeft()
    {
        moveLeft = true;
    }
    public void actionMoveLeftRelease()
    {
        moveLeft = false;
    }
    public void actionMoveRight()
    {
        moveRight = true;
    }
    public void actionMoveRightRelease()
    {
        moveRight = false;
    }
    public void actionMoveUp()
    {
        moveUp = true;
    }
    public void actionMoveUpRelease()
    {
        moveUp = false;
    }
    public void actionMoveDown()
    {
        moveDown = true;
    }
    public void actionMoveDownRelease()
    {
        moveDown = false;
    }

    public void actionZoomIn()
    {
        zoomIn = true;
    }
    public void actionZoomInRelease()
    {
        zoomIn = false;
    }
    public void actionZoomOut()
    {
        zoomOut = true;
    }
    public void actionZoomOutRelease()
    {
        zoomOut = false;
    }
}
