public IUnitMgr GetUnitMgr(Type unitType) { if (UnitMgrs.ContainsKey(unitType)) { return(UnitMgrs[unitType]); } return(null); }
public override T AddComponent <T>() { var ret = base.AddComponent <T>(); //加入组件列表 if (ret is IUnitMgr entityMgr) { UnitMgrs.Add(entityMgr.UnitType, entityMgr); } if (ret is IBaseSenseMgr senseMgr) { SenseMgrs.Add(senseMgr); } //添加组件 if (ret is IBaseSenseMgr && SenseMgr == null) { SenseMgr = ret as IBaseSenseMgr; } else if (ret is IBaseAttrMgr && AttrMgr == null) { AttrMgr = ret as IBaseAttrMgr; } else if (ret is IBaseBuffMgr && BuffMgr == null) { BuffMgr = ret as IBaseBuffMgr; } else if (ret is IBaseHUDMgr && HUDMgr == null) { HUDMgr = ret as IBaseHUDMgr; } else if (ret is IBaseMoveMgr && MoveMgr == null) { MoveMgr = ret as IBaseMoveMgr; } else if (ret is IBaseDipMgr && DipMgr == null) { DipMgr = ret as IBaseDipMgr; } else if (ret is IBaseLegionStationedMgr && LegionStationedMgr == null) { LegionStationedMgr = ret as IBaseLegionStationedMgr; } else if (ret is IBaseCastleStationedMgr && CastleStationedMgr == null) { CastleStationedMgr = ret as IBaseCastleStationedMgr; } else if (ret is BaseDetectionMgr && DetectionMgr == null) { DetectionMgr = ret as BaseDetectionMgr; } else if (ret is BaseNodeMgr && NodeMgr == null) { NodeMgr = ret as BaseNodeMgr; } else if (ret is BaseAnimMgr && AnimMgr == null) { AnimMgr = ret as BaseAnimMgr; } else if (ret is BaseVoiceMgr && AudioMgr == null) { AudioMgr = ret as BaseVoiceMgr; } else if (ret is BaseAIMgr && AIMgr == null) { AIMgr = ret as BaseAIMgr; } else if (ret is BaseFOWRevealerMgr && FOWMgr == null) { FOWMgr = ret as BaseFOWRevealerMgr; } else if (ret is BaseSurfaceMgr && SurfMgr == null) { SurfMgr = ret as BaseSurfaceMgr; } else if (ret is BasePerformMgr && PerformMgr == null) { PerformMgr = ret as BasePerformMgr; } else if (ret is BaseAStarMove2DMgr && Move2DMgr == null) { Move2DMgr = ret as BaseAStarMove2DMgr; } else if (ret is BaseMarkMgr && MarkMgr == null) { MarkMgr = ret as BaseMarkMgr; } return(ret); }