private static CyclopsManager GetManager(int id, SubRoot cyclops) { if (cyclops.isBase || !cyclops.isCyclops) { return(null); } CyclopsManager mgr = Managers.Find(m => m.InstanceID == cyclops.GetInstanceID()); return(mgr ?? CreateNewManagers(cyclops)); }
private static CyclopsManager CreateNewManagers(SubRoot cyclops) { var upgradeMgr = new UpgradeManager(); var powerMgr = new PowerManager(); var mgr = new CyclopsManager(cyclops); if (powerMgr.Initialize(mgr) && upgradeMgr.Initialize(mgr)) { mgr.UpgradeManager = upgradeMgr; mgr.PowerManager = powerMgr; Managers.Add(mgr); return(mgr); } return(null); }