Exemplo n.º 1
0
    /// <summary>
    /// load a specific camera saved pos if existed
    /// </summary>
    /// <param name="loadKeyC"></param>
    private void LoadCamPos(KeyCode loadKeyC, int listIdx = -1)
    {
        if (Dialog.IsActive())
        {
            return;
        }

        //no file was found
        if (list == null)
        {
            return;
        }

        for (int i = 0; i < list.Count; i++)
        {
            if ((list[i].loadKeyC == loadKeyC || listIdx == i) &&
                list[i].pos != Vector3.zero)
            {
                CenterTarget.rotation = list[i].rot;
                CenterTarget.position = list[i].CenterTargetPos;

                TransformCam.position = list[i].pos;
                TransformCam.rotation = list[i].rot;
                TransformCam.GetComponent <Camera>().fieldOfView = list[i].FOV;
            }
            else if (list[i].pos != Vector3.zero)
            {
                //                print("Cam pos was saved in this slot ??");
            }
        }
    }
Exemplo n.º 2
0
    public void Update()
    {
        if (leftChangeVal != 0)
        {
            var changeVal = ChangeValHand();

            TransformCam.position = MoveThruY(TransformCam, MIN_Y, MAX_Y, changeVal);
            TransformCam.LookAt(_target);
        }
    }
Exemplo n.º 3
0
    public void RotateCamHor(Transform helpCam360GrabPosY, Transform helpCam360MainY,
                             Transform target, float camSensivity)
    {
        TransformCam.parent = helpCam360GrabPosY.transform;
        float changeValue = 0;

        bool qOrE = false;

        if (Input.GetKey(KeyCode.Q) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)))
        {
            qOrE        = true;
            changeValue = .1f * camSensivity;
        }
        else if (Input.GetKey(KeyCode.Q))
        {
            qOrE        = true;
            changeValue = .4f * camSensivity;
        }

        if (Input.GetKey(KeyCode.E) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)))
        {
            qOrE        = true;
            changeValue = -.1f * camSensivity;
        }
        else if (Input.GetKey(KeyCode.E))
        {
            qOrE        = true;
            changeValue = -.4f * camSensivity;
        }

        //when Q or E this wont work
        if (Input.GetAxis("Mouse X") != 0 && !qOrE)
        {
            changeValue = Input.GetAxis("Mouse X") * camSensivity;
        }
        if (Input.GetAxis("Horizontal") != 0 && !qOrE)
        {
            changeValue = Input.GetAxis("Horizontal") * camSensivity;
        }

        if (changeValue != 0)
        {
            helpCam360MainY.transform.Rotate(new Vector3(0, changeValue, 0));
            TransformCam.LookAt(target);

            //leftChangeVal = changeValue;

            if (TutoWindow.IsStepReady("CamRot.Tuto"))
            {
                Program.gameScene.TutoStepCompleted("CamRot.Tuto");
            }
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// if the specific key was pressed will save the cam pos in the coorrespondant
    /// list item
    /// </summary>
    /// <param name="saveKeyC"></param>
    /// <param name="pos"></param>
    /// <param name="rot"></param>
    private void SaveCamPos(KeyCode saveKeyC, Vector3 pos, Quaternion rot)
    {
        if (list == null)
        {
            list = new List <RTSData>();
            InitializeList();
        }

        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].saveKeyC == saveKeyC)
            {
                list[i].pos             = pos;
                list[i].rot             = rot;
                list[i].FOV             = TransformCam.GetComponent <Camera>().fieldOfView;
                list[i].CenterTargetPos = CenterTarget.position;
            }
        }
    }