예제 #1
0
 public SettingsController(
     MathSiteDbContext context,
     MathServices services,
     IMapper mapper
     ) : base(context, services, mapper)
 {
 }
예제 #2
0
 public void OnStep()
 {
     if (_scouting)
     {
         foreach (var unit in _intel.UnitsEnemyVisible.Where(u => u.UnitType != BlizzardConstants.Unit.Overlord || u.UnitType != BlizzardConstants.Unit.Overseer || u.UnitType != BlizzardConstants.Unit.OverlordTransport))
         {
             if (MathServices.EuclidianDistance(unit, _scout) < 10)
             {
                 _combat.Move(_scout.Tag, GetFleePoint(_scout.Point, unit.Point));
                 _scouting = false;
             }
         }
     }
     if (!_scouting)
     {
         var sortedColonies = _intel.Colonies.OrderBy(c => MathServices.EuclidianDistance(c.Point, _eStart));
         foreach (var colony in sortedColonies)
         {
             _combat.Move(_scout.Tag, colony.Point, true);
         }
         _scouting = true;
     }
     if (_scout.Orders.Count == 0)
     {
         _scouting = false;
     }
 }
예제 #3
0
 public AuthController(
     MathSiteDbContext context,
     MathServices services,
     IOptions <ExtendedAuthData> authOptions
     ) : base(context, services)
 {
     _authData = authOptions.Value;
 }
 public DirectoriesController(
     MathSiteDbContext context,
     MathServices services,
     IMapper mapper,
     CrudServiceMethods <Directory, DirectoryDto> crudServiceMethods
     ) : base(context, services, mapper)
 {
     _crudServiceMethods = crudServiceMethods;
 }
예제 #5
0
        public void OnStep()
        {
            // Wait for the queued units to finish
            if (!_done && !_intelManager.ProductionQueue.Any())
            {
                foreach (var colony in _eStarts) // Then queue attack move command on each enemy starting location
                {
                    _combatManager.AttackMove(theGang, colony.Point, true);
                }
                _done = true; // Check to make sure we only do it once
            }

            if (_done)   // Once the attack has begun
            {
                foreach (var gangUnit in theGang.Units)
                {
                    // Find the enemys closest base using straight line distance
                    var point = _eStarts.OrderBy(c => MathServices.EuclidianDistance(gangUnit.Point, c.Point)).First().Point;

                    // Ïf the adepts are close enough to phase walk to the middle of the base, do it.
                    if (gangUnit.UnitType == BlizzardConstants.Unit.Adept)
                    {
                        if (MathServices.EuclidianDistance(gangUnit.Point, point) < 35 && MathServices.EuclidianDistance(gangUnit.Point, point) > 5)
                        {
                            _combatManager.UsePointCenteredAbility(BlizzardConstants.Ability.AdeptPhaseShift, gangUnit.Tag, point);
                        }
                    }
                    else if (gangUnit.UnitType == BlizzardConstants.Unit.Phoenix &&
                             !_intelManager.UnitsEnemyVisible.Any(u => u.BuffIds.Contains(BlizzardConstants.Buffs.GravitonBeam)))
                    {
                        // If there is not already an enemy affected by gravition beam, then find a visible unit
                        var eUnit = _intelManager.UnitsEnemyVisible.FirstOrDefault();
                        if (eUnit != null)
                        {
                            // and use Gravition beam on it
                            _combatManager.UseTargetedAbility(BlizzardConstants.Ability.GravitonBeam, gangUnit.Tag, eUnit.Tag);
                        }
                    }
                    else if (gangUnit.UnitType == BlizzardConstants.Unit.Sentry)
                    {
                        // If there are any visible enemies close
                        if (_intelManager.UnitsEnemyVisible.Any(e => MathServices.EuclidianDistance(e.Point, gangUnit.Point) < 15))
                        {
                            // Use guardian shield
                            _combatManager.UseTargetlessAbility(BlizzardConstants.Ability.GuardianShield, gangUnit.Tag);
                        }
                    }
                    if (!gangUnit.Orders.Any() && MathServices.EuclidianDistance(gangUnit.Point, point) > 5) // If the unit is doing nothing and is not standing on a base
                    {
                        foreach (var colony in _eStarts)                                                     // Queue an attack move command on each enemy starting location
                        {
                            _combatManager.AttackMove(theGang, colony.Point, true);
                        }
                    }
                }
            }
        }
예제 #6
0
 public ProfessorsController(MathSiteDbContext context,
                             MathServices services,
                             IMapper mapper,
                             CrudServiceMethods <Professor, ProfessorDto> crudServiceMethods,
                             PageableServiceMethods <Professor, ProfessorDto> pageableServiceMethods,
                             CountableServiceMethods <Professor> countableServiceMethods) : base(context, services, mapper)
 {
     _crudServiceMethods      = crudServiceMethods;
     _pageableServiceMethods  = pageableServiceMethods;
     _countableServiceMethods = countableServiceMethods;
 }
예제 #7
0
 public FilesController(
     IFileFacade fileFacade,
     MathSiteDbContext context,
     MathServices services,
     IMapper mapper,
     CrudServiceMethods <Entities.File, FileDto> crudServiceMethods
     ) : base(context, services, mapper)
 {
     _fileFacade         = fileFacade;
     _crudServiceMethods = crudServiceMethods;
     _fileFormatBuilder  = new FileFormatBuilder();
 }
 public CategoriesController(
     MathSiteDbContext context,
     MathServices services,
     IMapper mapper,
     CrudServiceMethods <Category, CategoryDto> crudServiceMethods,
     PageableServiceMethods <Category, CategoryDto> pageableServiceMethods,
     CountableServiceMethods <Category> countableServiceMethods
     ) : base(context, services, mapper)
 {
     _crudServiceMethods      = crudServiceMethods;
     _pageableServiceMethods  = pageableServiceMethods;
     _countableServiceMethods = countableServiceMethods;
 }
예제 #9
0
 public GroupsController(
     MathSiteDbContext context,
     MathServices services,
     IMapper mapper,
     CrudServiceMethods <Group, GroupDto> crudServiceMethods,
     PageableServiceMethods <Group, GroupDto> pageableServiceMethods,
     CountableServiceMethods <Group> countableServiceMethods
     ) : base(context, services, mapper)
 {
     _crudServiceMethods      = crudServiceMethods;
     _pageableServiceMethods  = pageableServiceMethods;
     _countableServiceMethods = countableServiceMethods;
 }
예제 #10
0
 public FileFacade(
     MathSiteDbContext context,
     MathServices services,
     IFileStorage fileStorage,
     IMapper mapper
     )
 {
     Context      = context;
     Services     = services;
     Repository   = context.Set <File>();
     _fileStorage = fileStorage;
     Mapper       = mapper;
 }
예제 #11
0
 public UsersController(
     MathSiteDbContext context,
     MathServices services,
     IMapper mapper,
     IPasswordsManager passwordsManager,
     CrudServiceMethods <User, UserDto> crudServiceMethods,
     PageableServiceMethods <User, UserDto> pageableServiceMethods,
     CountableServiceMethods <User> countableServiceMethods
     ) : base(context, services, mapper)
 {
     _passwordsManager        = passwordsManager;
     _crudServiceMethods      = crudServiceMethods;
     _pageableServiceMethods  = pageableServiceMethods;
     _countableServiceMethods = countableServiceMethods;
 }
예제 #12
0
        //TODO: Make smarter.
        private void UpdatePower(PowerSource source)
        {
            var p      = source.Pos.ConvertTo2D();
            var r      = source.Radius;
            var startX = MathF.Round(p.X - r);
            var startY = MathF.Round(p.Y - r);
            var size   = (int)(r * 2);
            var mx     = (int)startX + size;
            var my     = (int)startY + size;

            for (int x = (int)startX; x < mx; x++)
            {
                for (int y = (int)startY; y < my; y++)
                {
                    if (MathServices.EuclidianDistance(p, x, y) <= r)
                    {
                        Power.Set(x, y, 1);
                    }
                }
            }
        }
예제 #13
0
        public void OnStep()
        {
            var workerAmount = _intel.WorkersSelf().Count();

            if (!_intel.ProductionQueue.Any() && workerAmount < _baseAmount * 16)
            {
                for (int i = _intel.WorkersSelf().Count(); i < _baseAmount * 16; i++)
                {
                    _productionManager.QueueUnit(workerType);
                }
            }
            else if (!_intel.ProductionQueue.Any())   //TODO Seemingly 4 SCV's get stuck in the production queue but is never made(using AutoExpand and AutoSupply)
            {
                var curCol = _mainBuildings.Units.First();
                //TODO Use AStar distance rather than a Euclidian distance
                var nextCol = _intel.Colonies.OrderBy(c => MathServices.EuclidianDistance(curCol.Point, c.Point)).FirstOrDefault(col => col.Structures.Count == 0);
                if (nextCol != null)
                {
                    _productionManager.QueueUnit(_mainBuildingTypes.First(), nextCol.Point, 3);//TODO the placement algorithm does not take mineral spacing from HQ's into account and giving a spacing of 3 will make other objects block the HQ's
                }
            }
        }
예제 #14
0
 public EntityApiControllerBase(MathSiteDbContext context, MathServices services, IMapper mapper)
     : base(context, services, mapper)
 {
 }
예제 #15
0
 public static void Main(string[] args)
 {
     var service = new MathServices();
     //var number = service.MultiplyNumbers(1, 100);
     var unlimitedNumberTest = service.MultiplyUnlimitedNumbers(3, 3, 2147483647);
 }
예제 #16
0
 protected ApiControllerBase(MathSiteDbContext context, MathServices services)
 {
     Context  = context;
     Services = services;
 }