예제 #1
0
 private void RefreshToolKits()
 {
     m_toolKits.Clear();
     m_inventoryItemsHelper.Clear();
     m_smallShipOwner.Inventory.GetInventoryItems(ref m_inventoryItemsHelper, MyMwcObjectBuilderTypeEnum.SmallShip_Tool, null);
     foreach (MyInventoryItem inventoryItem in m_inventoryItemsHelper)
     {
         if (MyToolKit.IsSupportedToolKitItem(inventoryItem))
         {
             m_toolKits.Add(MyToolKit.CreateInstance(m_smallShipOwner, m_playerOwner, inventoryItem));
         }
     }
 }
예제 #2
0
 public void Update()
 {
     for (int i = m_toolKits.Count - 1; i >= 0; i--)
     {
         MyToolKit toolKit = m_toolKits[i];
         toolKit.Update();
         if (toolKit.IsEmpty())
         {
             m_smallShipOwner.Inventory.OnInventoryContentChange -= OnInventoryContentChangedHandler;
             m_smallShipOwner.Inventory.RemoveInventoryItem(toolKit.GetToolInventoryItem(), true);
             m_smallShipOwner.Inventory.OnInventoryContentChange += OnInventoryContentChangedHandler;
             m_toolKits.RemoveAt(i);
         }
     }
 }