private void HandleDUIButtonPressed(CDUIDispenserRoot _DUI) { // Check there is enough nanites for the selected tool CShipNaniteSystem sns = CGameShips.Ship.GetComponent <CShipNaniteSystem>(); if (sns.IsEnoughNanites(_DUI.SelectedToolCost) || m_Debug) { // Deduct the amount if (!m_Debug) { sns.DeductNanites(_DUI.SelectedToolCost); } // Spawn the selected tool SpawnTool(_DUI.SelectedToolType); } }
private void OnDUIBuildButtonPressed() { CModulePortInterface currentPort = m_DUIModuleCreationRoot.CurrentPortSelected.GetComponent <CModulePortInterface>(); CShipNaniteSystem sns = CGameShips.Ship.GetComponent <CShipNaniteSystem>(); if (sns.IsEnoughNanites(m_DUIModuleCreationRoot.SelectedModuleCost) || m_Debug) { // Minus the amount if (!m_Debug) { sns.DeductNanites(m_DUIModuleCreationRoot.SelectedModuleCost); } // Debug: Create the module instantly currentPort.CreateModule(m_DUIModuleCreationRoot.SelectedModuleType); // Deactivate the UI m_DUIActive.Set(false); } }