private PlayerToolData GetPlayerToolData(InventoryItem item) { if (item == null) { QuickLogger.Error("Failed to get Inventory Item", true); return(null); } if (item.item == null) { QuickLogger.Error("Failed to get Pickupable Item", true); return(null); } var energyMixin = item.item?.GetComponentInChildren <EnergyMixin>(); var playerToolData = new PlayerToolData { TechType = item.item.GetTechType() }; if (energyMixin == null) { return(playerToolData); } var batteryGo = energyMixin.GetBattery().gameObject; var techType = batteryGo.GetComponentInChildren <TechTag>().type; var iBattery = batteryGo.GetComponentInChildren <Battery>(); playerToolData.BatteryInfo = new BatteryInfo(techType, iBattery, String.Empty); return(playerToolData); }
private static PlayerToolData GetBatteryData(InventoryItem item) { var batteryGo = item.item.GetComponentInChildren <Battery>(); var playerToolData = new PlayerToolData { TechType = item.item.GetTechType() }; var techType = batteryGo.GetComponent <TechTag>().type; var iBattery = batteryGo.GetComponent <IBattery>(); playerToolData.BatteryInfo = new BatteryInfo(techType, iBattery, String.Empty); return(playerToolData); }