public class Camera1 : MonoBehaviour {
    
    
    private const int BoderThickness = 30;
    private const float Speed = 200;
    private const float mousewheel = 400;
  
 
    void Start() {
       

        Camera.main.transform.position = new Vector3(0, 20, 0);
       
    }
void Update () {
     
           movingwheel();
           RotatingCamera();
           MovingCamera();
            
     }








    private void movingwheel()
    {
        Vector3 camera1 = Camera.main.transform.TransformVector(0, 0, 0);

        
        if (Input.GetAxis("Mouse ScrollWheel") > 0f)
        {
          
            Camera.main.transform.position += Vector3.MoveTowards(camera1, new Vector3(0, -1,0), mousewheel * Time.deltaTime);

        }
        else if (Input.GetAxis("Mouse ScrollWheel") < 0f)
        {
            Camera.main.transform.position += Vector3.MoveTowards(camera1, new Vector3(0, 1, 0), mousewheel * Time.deltaTime)
                ;
        }
        
        

    }
    private void MovingCamera()
    {
        Vector3 camera1 = Camera.main.transform.TransformVector(0, 0, 0);
       
        if (Input.GetKey(KeyCode.W) || Input.mousePosition.y > Screen.height - BoderThickness)
        {
            Camera.main.transform.position += Vector3.MoveTowards(camera1, new Vector3(0, 0, 1), Time.deltaTime * Speed);



        }
        if (Input.GetKey(KeyCode.S) || Input.mousePosition.y < BoderThickness)
        {
            Camera.main.transform.position += Vector3.MoveTowards(camera1, new Vector3(0, 0, -1), Time.deltaTime * Speed);


        }
        if (Input.GetKey(KeyCode.D) || Input.mousePosition.x > Screen.width - BoderThickness)
        {
            Camera.main.transform.position += Vector3.MoveTowards(camera1, new Vector3(1, 0, 0), Time.deltaTime * Speed);


        }
        if (Input.GetKey(KeyCode.A) || Input.mousePosition.x < BoderThickness)
        {
            Camera.main.transform.position += Vector3.MoveTowards(camera1, new Vector3(-1, 0, 0), Time.deltaTime * Speed);


        }
    }
    private void RotatingCamera()
    {
        Vector3 camera1 = Camera.main.transform.TransformVector(0, 0, 0);
        if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(1))
        {
            Vector3 origin = Camera.main.transform.eulerAngles;
            Vector3 destination = origin;

            destination.x += Input.GetAxis("Mouse Y") * 100f;
            destination.y -= Input.GetAxis("Mouse X") * 100f;

            Camera.main.transform.eulerAngles = Vector3.MoveTowards(origin, destination, Time.deltaTime * 100f);
        }
    }
}