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

public class moving_camera : MonoBehaviour
{   
    public float speed = 0.01f;
    public float curr_x = 0.0f;
    public float curr_y = 0.0f;
    public float curr_z = 0.0f;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    void update_pos(){
        
        Vector3 curr_pos = GameObject.Find("easy_player_camera").transform.position;
        curr_x = curr_pos[0];
        curr_y = curr_pos[1];
        curr_z = curr_pos[2];

    }

    // Update is called once per frame
       void Update()
 {
     update_pos();

     if(Input.GetKey(KeyCode.RightArrow))
     {
         transform.position = new Vector3(curr_x,curr_y, curr_z + speed * Time.deltaTime);
     
     }
     if(Input.GetKey(KeyCode.LeftArrow))
     {
        transform.position = new Vector3(curr_x ,curr_y ,curr_z - speed * Time.deltaTime);
         }
     if(Input.GetKey(KeyCode.DownArrow))
     {
         transform.position = new Vector3(curr_x + speed * Time.deltaTime,curr_y,curr_z);}
     if(Input.GetKey(KeyCode.UpArrow))
     {
         transform.position = new Vector3(curr_x - speed * Time.deltaTime,curr_y,curr_z);
     
     }
     if(Input.GetKey(KeyCode.Q))
     {
         
        transform.eulerAngles = new Vector3(
                                        transform.eulerAngles.x,
                                        transform.eulerAngles.y + 0.5f,
                                        transform.eulerAngles.z
                                    );
     
     }
     if(Input.GetKey(KeyCode.E))
     {
        transform.eulerAngles = new Vector3(
                                        transform.eulerAngles.x,
                                        transform.eulerAngles.y - 0.5f,
                                        transform.eulerAngles.z
                                    );
     }
 }
}
