Exemplo n.º 1
0
    void Update()
    {
        float currenFillRatio = m_Weapon.currentAmmoRatio;

        ammoFillImage.fillAmount = Mathf.Lerp(ammoFillImage.fillAmount, currenFillRatio, Time.deltaTime * ammoFillMovementSharpness);

        bool isActiveWeapon = m_Weapon == m_PlayerWeaponsManager_Photon.GetActiveWeapon();

        canvasGroup.alpha    = Mathf.Lerp(canvasGroup.alpha, isActiveWeapon ? 1f : unselectedOpacity, Time.deltaTime * 10);
        transform.localScale = Vector3.Lerp(transform.localScale, isActiveWeapon ? Vector3.one : unselectedScale, Time.deltaTime * 10);
        controlKeysRoot.SetActive(!isActiveWeapon);



        FillBarColorChange.UpdateVisual(currenFillRatio);
    }
Exemplo n.º 2
0
    void Start()
    {
        m_PlayerWeaponsManager = manager.m_Player.m_WeaponsManager;

        WeaponController_Photon activeWeapon = m_PlayerWeaponsManager.GetActiveWeapon();

        if (activeWeapon)
        {
            AddWeapon(activeWeapon, m_PlayerWeaponsManager.activeWeaponIndex);
            ChangeWeapon(activeWeapon);
        }

        m_PlayerWeaponsManager.onAddedWeapon      += AddWeapon;
        m_PlayerWeaponsManager.onRemovedWeapon    += RemoveWeapon;
        m_PlayerWeaponsManager.onSwitchedToWeapon += ChangeWeapon;
    }