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

public class Controls : MonoBehaviour
{
    public void ClickForward()
    {
        GameManager.instance.ship.EjectObjectForward();
    }

    public void ClickBackward()
    {
        GameManager.instance.ship.EjectObjectBackward();
    }

    public void ClickEngines()
    {
        GameManager.instance.ship.EnginesOn();
    }

    public void ReleaseEngines()
    {
        GameManager.instance.ship.EnginesOff();
    }

    public void ClickRepair()
    {
        GameManager.instance.engine.RepairEngines();
    }

    private void Update()
    {
        if (Input.mouseScrollDelta.y < 0f)
        {
            GameManager.instance.cameraControl.ZoomOut();
        }
        else if (Input.mouseScrollDelta.y > 0f)
        {
            GameManager.instance.cameraControl.ZoomIn();            
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (GameManager.instance.escapePanel.interactable)
            {
                GameManager.instance.escapePanel.alpha = 0f;
                GameManager.instance.escapePanel.blocksRaycasts = false;
                GameManager.instance.escapePanel.interactable = false;
            }
            else
            {
                GameManager.instance.escapePanel.alpha = 1f;
                GameManager.instance.escapePanel.blocksRaycasts = true;
                GameManager.instance.escapePanel.interactable = true;
            }
        }
    }
}
