Exemple #1
0
        public ISerializableBotTask GetSetModuleActiveTask(ShipFit.ModuleType type, bool shouldBeActive)
        {
            switch (type)
            {
            case ShipFit.ModuleType.Weapon:
                var weaponGroup = Fit.GetWeapon();
                if (!weaponGroup.UiModule.IsReloading(bot))
                {
                    return(weaponGroup.EnsureActive(bot, shouldBeActive));
                }

                break;

            case ShipFit.ModuleType.Hardener:
            case ShipFit.ModuleType.ShieldBooster:
            case ShipFit.ModuleType.MWD:
            case ShipFit.ModuleType.Etc:
                return(Fit.GetAllByType(type).Select(m => m.EnsureActive(bot, shouldBeActive))
                       .FirstOrDefault(t => t != null));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(null);
        }