private static void SetTech(Tech selectedTech, ref Tech tech) { // Check if the tech was changed. if (tech == null) { // Set and activate the tech. tech = selectedTech; selectedTech.Activate(); } else { // Our tech needs to be switched and activated. if (tech == selectedTech) { return; } StopTechAbilties(tech); tech.Deactivate(); tech = selectedTech; selectedTech.Activate(); } }