System.Type ModuleListToComponent(UIStaticData.moduleList moduleList) { //no breaks in this switch as in all cases method returns switch (moduleList) { case UIStaticData.moduleList.None: return(typeof(EmptyModule)); case UIStaticData.moduleList.HullReinforcement: return(typeof(HullReinforcement)); case UIStaticData.moduleList.AutoRepair: return(typeof(AutoRepair)); case UIStaticData.moduleList.ImprovedArmor: return(typeof(ImprovedArmor)); case UIStaticData.moduleList.NavigationSystems: return(typeof(NavigationSystems)); case UIStaticData.moduleList.TemporaryArmor: return(typeof(TemporaryArmor)); default: Debug.LogWarning("No Module class assigned for this module, check ModuleListToComponent method in ModuleLoader class"); return(typeof(EmptyModule)); } }
void SpawnModule(UIStaticData.moduleList component, int id) { moduleObjects[id].AddComponent(ModuleListToComponent(component)); }
public void SetModule(UIStaticData.moduleList module) { moduleList[currentModule] = module; }