Пример #1
0
        public IEnumerable <Action> BuildAddOns()
        {
            var commands = new List <Action>();

            if (lastFailFrame < MacroData.Frame - 100)
            {
                foreach (var proxy in MacroData.Proxies)
                {
                    foreach (var unit in proxy.Value.DesiredAddOnCounts)
                    {
                        if (ActiveUnitData.SelfUnits.Count(u => u.Value.Unit.UnitType == (uint)unit.Key && Vector2.DistanceSquared(u.Value.Position, new Vector2(proxy.Value.Location.X, proxy.Value.Location.Y)) < proxy.Value.MaximumBuildingDistance * proxy.Value.MaximumBuildingDistance) < unit.Value)
                        {
                            var unitData = SharkyUnitData.AddOnData[unit.Key];
                            var command  = BuildingBuilder.BuildAddOn(MacroData, unitData, proxy.Value.Location);
                            if (command != null)
                            {
                                commands.AddRange(command);
                                continue;
                            }
                        }
                    }
                }
            }



            return(commands);
        }
Пример #2
0
        private List <Action> BuildAddOns()
        {
            var commands = new List <Action>();

            if (SkipAddons)
            {
                SkipAddons = false;
                return(commands);
            }
            var begin = System.DateTime.UtcNow;

            foreach (var unit in MacroData.BuildAddOns)
            {
                if (unit.Value)
                {
                    var unitData = SharkyUnitData.AddOnData[unit.Key];
                    var command  = BuildingBuilder.BuildAddOn(MacroData, unitData);
                    if (command != null)
                    {
                        commands.AddRange(command);
                        continue;
                    }
                }
            }

            var endTime = (System.DateTime.UtcNow - begin).TotalMilliseconds;

            if (endTime > 1)
            {
                SkipAddons = true;
            }

            return(commands);
        }