// Member Properties // Member Methods public void Start() { // Get the DUI of the dispenser m_DUIDispenser = m_DUIConsole.DUI.GetComponent <CDUIDispenserRoot>(); // Register the event for building a tool m_DUIDispenser.EventBuildToolButtonPressed += HandleDUIButtonPressed; }
// Member Properties // Member Methods public void Start() { // Get the DUI of the dispenser m_DUIDispenser = m_DUIConsole.DUI.GetComponent<CDUIDispenserRoot>(); // Register the event for building a tool m_DUIDispenser.EventBuildToolButtonPressed += HandleDUIButtonPressed; }
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 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); } }