Exemplo n.º 1
0
    /// <summary>
    /// update the scroller with the current weapon
    /// </summary>
    protected virtual void OnStop_SetWeapon()
    {
        if (Manager.Player.Dead.Active)
        {
            return;
        }

        int id = (int)Manager.Player.SetWeapon.Argument;

        if (id != 0)
        {
            m_LastWeaponID = id;
        }

        WeaponScrollerItem item;

        m_Weapons.TryGetValue(Manager.Player.CurrentWeaponName.Get(), out item);
        if (item != null)
        {
            if (!m_EquippedWeapons.ContainsKey(item.Name))
            {
                m_EquippedWeapons.Add(item.Name, item);
                UpdateScrollerItems();
            }
            m_CurrentItem = m_EquippedWeapons[item.Name];
            vp_Utility.Activate(item.Transform.gameObject, true);
            CurrentItemPosition();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// reset scroller if player dies
    /// </summary>
    protected virtual void OnStart_Dead()
    {
        m_CurrentItem = null;
        m_EquippedWeapons.Clear();
        m_Inventory.CurrentWeaponStatus = null;

        foreach (WeaponScrollerItem weapon in m_Weapons.Values)
        {
            vp_Utility.Activate(weapon.Transform.gameObject, false);
        }
    }
    /// <summary>
    /// update the scroller with the current weapon
    /// </summary>
    protected virtual void OnStop_SetWeapon()
    {
        if(Manager.Player.Dead.Active)
            return;

        int id = (int)Manager.Player.SetWeapon.Argument;
        if(id != 0)
            m_LastWeaponID = id;

        WeaponScrollerItem item;

        m_Weapons.TryGetValue(Manager.Player.CurrentWeaponName.Get(), out item);

        if (item != null)
        {
            if (!m_EquippedWeapons.ContainsKey(item.Name))
            {
                m_EquippedWeapons.Add(item.Name, item);
                UpdateScrollerItems();
            }
            m_CurrentItem = m_EquippedWeapons[item.Name];
            vp_Utility.Activate(item.Transform.gameObject, true);
            CurrentItemPosition();
        }
        else if (m_CurrentItem != null)
            vp_Utility.Activate(m_CurrentItem.Transform.gameObject, false);
    }
    /// <summary>
    /// reset scroller if player dies
    /// </summary>
    protected virtual void OnStart_Dead()
    {
        m_CurrentItem = null;
        m_EquippedWeapons.Clear();

        foreach(WeaponScrollerItem weapon in m_Weapons.Values)
            vp_Utility.Activate( weapon.Transform.gameObject, false );
    }