Exemplo n.º 1
0
    //---------------------------------------------------------------

    /*
     *  @brief      カメラの回転
     */
    //---------------------------------------------------------------
    public void RotateCamera(float v, float h)
    {
        if (!m_camera)
        {
            return;
        }

        angle_yaw += h * ROTATE_UNIT_ANGLE * GameDefine.FPSDeltaScale();
        if (angle_yaw > 360.0f)
        {
            angle_yaw -= 360.0f;
        }
        if (angle_yaw < 0)
        {
            angle_yaw += 360.0f;
        }
        angle_pitch += v * ROTATE_UNIT_ANGLE * GameDefine.FPSDeltaScale();
        if (angle_pitch > 360.0f)
        {
            angle_pitch -= 360.0f;
        }
        if (angle_pitch < 0.0f)
        {
            angle_pitch += 360.0f;
        }

        totalRotation = Quaternion.Euler(angle_pitch, angle_yaw, 0.0f);
        m_camera.transform.rotation = totalRotation;
    }
Exemplo n.º 2
0
    //--------------------------------------------------------------------

    /*
     *  @brief      ターゲットOBJへのオフセット座標を更新する
     */
    //--------------------------------------------------------------------
    void UpdateOffsetPosition(float v, float h)
    {
        float moveX = h * 0.1f * GameDefine.FPSDeltaScale();
        float moveY = v * 0.1f * GameDefine.FPSDeltaScale();

        m_offsetPos.x += moveX;
        m_offsetPos.y += moveY;
    }
Exemplo n.º 3
0
    //--------------------------------------------------------------------

    /*
     *  @brief      ターゲットOBJを回転させる
     */
    //--------------------------------------------------------------------
    void RotateTargetObj(float v, float h)
    {
        target_yaw   += h * ROTATE_UNIT_ANGLE * GameDefine.FPSDeltaScale();
        target_pitch += v * ROTATE_UNIT_ANGLE * GameDefine.FPSDeltaScale();

        Quaternion rot = Quaternion.Euler(target_pitch, target_yaw, 0.0f);

        m_targetObj.transform.rotation = rot;
    }
Exemplo n.º 4
0
 void ChangeTargetDistance(float forward, float back)
 {
     m_targetDistance -= (forward * 0.25f * GameDefine.FPSDeltaScale());
     if (m_targetDistance <= 3.0f)
     {
         m_targetDistance = 3.0f;
     }
     m_targetDistance += (back * 0.25f * GameDefine.FPSDeltaScale());
 }
Exemplo n.º 5
0
    void RotateRocket()
    {
        float lh = Input.GetAxis("Horizontal");

        if (lh > 0.25f || lh < -0.25f)
        {
            rocketRot += (lh * 1.0f) * GameDefine.FPSDeltaScale();

            Quaternion rot = Quaternion.AngleAxis(rocketRot, transform.up);

            transform.FindChild("chairs").FindChild("chairs:root").FindChild("chairs:barrel").rotation = rot;
        }
    }
Exemplo n.º 6
0
    //-----------------------------------------------------------------

    /*
     *  @brief  ターゲットOBJの周りを回転する
     */
    //-----------------------------------------------------------------
    void AroundRotate(float v, float h)
    {
        angle_yaw   += h * ROTATE_UNIT_ANGLE * GameDefine.FPSDeltaScale();
        angle_pitch += v * ROTATE_UNIT_ANGLE * GameDefine.FPSDeltaScale();
        if (angle_pitch >= 60.0f)
        {
            angle_pitch = 60.0f;
        }
        if (angle_pitch <= -60.0f)
        {
            angle_pitch = -60.0f;
        }

        Vector3    yawAxis = Vector3.Scale(m_targetPos, Vector3.up).normalized;
        Quaternion rot     = Quaternion.Euler(angle_pitch, angle_yaw, 0.0f);

        Vector3 rotatedVector = rot * m_offsetVector;
        Vector3 lookAt        = m_targetPos + m_offsetPos;

        m_camera.transform.position = m_targetPos + m_offsetPos + (rotatedVector * m_targetDistance);
        m_camera.transform.LookAt(lookAt);
    }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        /*
         * if( vrFade != null )
         * {
         *  return ;
         * }
         */

        bool bFinish = false;

        switch (fadeType)
        {
        case FadeType.FADE_IN:
            bFinish = FadeIn();
            break;

        case FadeType.FADE_OUT:
            bFinish = FadeOut();
            break;
        }

        // フェードカウンター
        if (IsFade())
        {
            counter += GameDefine.FPSDeltaScale();

            if ((int)counter > FadeTime)
            {
                counter = FadeTime;
                if (bFinish)
                {
                    Debug.Log("Fade" + fadeType + "Is Finish");
                    fadeType = FadeType.FADE_NONE;
                    counter  = 0.0f;
                }
            }
        }
    }