Пример #1
0
    void Update()
    {
        Look();
        Move();

        // Temp gun
        float wheelDir = Input.GetAxisRaw("Mouse ScrollWheel");

        if (wheelDir != 0.0f)
        {
            if (wheelDir != -0.1f)
            {
                ++m_CurrentGunIdx;
                if (m_CurrentGunIdx > m_Gunhandler.GetNumOfGuns() - 1)
                {
                    m_CurrentGunIdx = 0;
                }
            }
            else
            {
                --m_CurrentGunIdx;
                if (m_CurrentGunIdx < 0)
                {
                    m_CurrentGunIdx = m_Gunhandler.GetNumOfGuns() - 1;
                }
            }

            m_Gunhandler.SetActiveGun(m_CurrentGunIdx);
        }

        if (Input.GetMouseButton(0))
        {
            m_Gunhandler.Fire(m_PlayerEyePoint.transform);
        }
    }