Example #1
0
        public override void OnStart()
        {
            m_CurrentAgent = GetDefaultGameObject(m_Agent.Value);
            if (m_CurrentAgent != m_PrevAgent)
            {
                FpsInventoryBase inventory = m_CurrentAgent.GetComponent <FpsInventoryBase>();
                if (inventory.selected != null)
                {
                    m_Weapon = inventory.selected.gameObject.GetComponent <IAiWeapon>();
                    inventory.onSelectionChanged += WieldableSelectionChanged;
                }
                else
                {
                    m_Weapon = null;
                }

                if (m_PrevAgent != null)
                {
                    inventory = m_PrevAgent.GetComponent <FpsInventoryBase>();
                    inventory.onSelectionChanged -= WieldableSelectionChanged;
                }

                m_PrevAgent = m_CurrentAgent;
            }
        }
Example #2
0
 private void OnPlayerSpawn()
 {
     m_Player    = GameObject.FindGameObjectWithTag("Player").transform;
     m_Inventory = m_Player.GetComponent <FpsInventoryBase>();
     m_Inventory.onSelectionChanged += OnInventorySelectionChanged;
     OnInventorySelectionChanged(m_Inventory.selected);
 }