예제 #1
0
    protected void ApplyCameraSettings()
    {
        Camera playerCamera = Camera.main;

        CameraOperator.SetActiveCamera(playerCamera);

        if (crosshair != null)
        {
            crosshair.gameObject.SetActive(false);
        }

        if (cameraScheme == CameraScheme.FirstPerson || cameraScheme == CameraScheme.ThirdPerson)
        {
            playerCamera.fieldOfView = cameraFOV;

            CameraOperator.AttachTo(GetLookTransform());
            playerCamera.transform.localRotation = Quaternion.identity;

            if (cameraScheme == CameraScheme.ThirdPerson)
            {
                playerCamera.transform.localEulerAngles = new Vector3(cameraAngle, 0.0f, 0.0f);
                playerCamera.transform.localPosition    = playerCamera.transform.forward * cameraDistance;
            }
            else
            {
                if (crosshair != null)
                {
                    crosshair.gameObject.SetActive(true);
                }
            }
        }
        else if (cameraScheme == CameraScheme.Overhead)
        {
            if (cameraFollow)
            {
                CameraLookAtFocus();
                CameraFollowFocus();
            }

            playerCamera.transform.position = new Vector3(playerCamera.transform.position.x, cameraHeight, playerCamera.transform.position.z);
        }
    }