コード例 #1
0
    /// <summary>
    /// Classic 3D view. Change camera to perspective, smooth move to endPos.
    /// </summary>
    /// <param name="endPos">Final position of the camera</param>
    private IEnumerator ChangeTo3DCamera(Vector3 endPos)
    {
        m_plane.SetActive(false);
        m_musicManager.ReverbeChangerCamera3D();
        m_cameraState = ECamState.Ortho3D;
        ShowTrails(false, 0);
        HideIcons();
        m_mainCamera.orthographic = false;
        m_mainCamera.fieldOfView  = 110f;

        Quaternion rotStart = m_mainCamera.transform.rotation;
        Vector3    startPos = m_mainCamera.transform.position;
        float      fovStart = 110f;
        float      fovEnd   = 40f;
        float      lerpTime = 0;

        while (lerpTime <= m_transitionTime)
        {
            lerpTime += Time.deltaTime;
            float t = lerpTime / m_transitionTime;
            t = Mathf.SmoothStep(0, 1, t);
            m_mainCamera.fieldOfView        = Mathf.Lerp(fovStart, fovEnd, t);
            m_mainCamera.transform.rotation = Quaternion.Lerp(rotStart, m_initRot, t);
            m_mainCamera.transform.position = Vector3.Lerp(startPos, endPos, t);
            yield return(null);
        }
        m_canUnzoom = true;
        UIGlobal.Instance.GetUISpawnUnit().ShowSpawnUnitUI();
        GameManager.Instance.GetLocalPlayerEntity().ShowUISelectedItem();
    }
コード例 #2
0
 public new void Start()
 {
     foreach (CamState camState in GetComponents <CamState>())
     {
         if (CamStates[(int)camState.state] == null)
         {
             CamStates[(int)camState.state] = camState;
         }
     }
     m_pTransform = transform;
     m_PrevState  = ECamState.None;
     CurrentState = m_StartState;
 }
コード例 #3
0
        private new void FixedUpdate()
        {
            //some bullshit that doesnt depend on the state being in the enum if we're in freecam
            //re: no u

            if (CurrentState == ECamState.None)
            {
                return;
            }

            ECamState currentState  = CurrentState;
            ECamState currentState2 = GetCurrentStateClassFix().Manage(Time.fixedDeltaTime);

            m_pTransform.position = GetCurrentStateClassFix().m_Transform.position;
            m_pTransform.rotation = GetCurrentStateClassFix().m_Transform.rotation;

            if (currentState == CurrentState)
            {
                CurrentState = currentState2;
            }
        }
コード例 #4
0
    /// <summary>
    /// Tactical2D view. Unzoom and center camera, then change to orthographic.
    /// </summary>
    private IEnumerator ChangeTo2DCamera()
    {
        UIGlobal.Instance.GetUISpawnUnit().HideSpawnUnitUI();
        GameManager.Instance.GetLocalPlayerEntity().HideUISelectedItem();

        m_musicManager.ReverbeChangerCamera2D();
        m_lastPosition = m_mainCamera.transform.position;
        Vector3 endPos   = new Vector3(m_centerMap.position.x, m_mainCamera.transform.position.y, m_centerMap.position.z);
        float   startFov = m_mainCamera.fieldOfView;

        float lerpTime = 0;

        while (lerpTime <= m_transitionTime)
        {
            lerpTime += Time.deltaTime;
            float t = lerpTime / m_transitionTime;
            t = Mathf.SmoothStep(0, 1, t);
            m_mainCamera.fieldOfView        = Mathf.Lerp(startFov, 130f, t);
            m_mainCamera.transform.rotation = Quaternion.Lerp(m_initRot, Quaternion.Euler(90, 0, 0), t);
            m_mainCamera.transform.position = Vector3.Lerp(m_lastPosition, endPos, t);
            yield return(null);
        }
        m_cameraState                 = ECamState.Iso2D;
        m_mainCamera.orthographic     = true;
        m_mainCamera.orthographicSize = (float)m_2DYpoint;
        ShowTrails(true, 0);
        m_musicManager.ReverbeChangerCamera2D();
        ShowIcons();

        m_canUnzoom = true;

        m_plane.SetActive(true);

        Vector3 position = m_mainCamera.transform.position;

        position.y += 80;
        m_mainCamera.transform.position = position;
    }