Exemple #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 ??");
            }
        }
    }
Exemple #2
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;
            }
        }
    }