Exemplo n.º 1
0
        private bool ProduceVespene(ProductionOrder order)
        {
            var colony     = order.Position == null ? intelManager.PrimaryColony : order.Position.GetClosest(intelManager.Colonies);
            var refineries = colony.Structures.Where(b => GameConstants.IsVespeneGeyserBuilding(b.UnitType));
            var target     = colony.Vespene.FirstOrDefault(v => !refineries.Any(r => r.Pos.X == v.Pos.X && r.Pos.Y == v.Pos.Y));
            var worker     = GetWorker(target);

#if DEBUG
            if (target == null)
            {
                log.LogError($"ProductionManager: No available vespene geyser for {order.Unit.Name} at colony {colony.Id}");
                return(false);
            }
            if (worker == null)
            {
                log.LogWarning($"ProductionManager: No worker found for {order.Unit.Name}");
                return(false);
            }
            if (!ReserveRessource(order.Unit))
            {
                return(false);
            }
#else
            if (target == null || worker == null || !ReserveRessource(order.Unit))
            {
                return(false);
            }
#endif
            order.Status       = ProductionOrder.OrderStatus.Commissioned;
            order.AssignedUnit = worker;
            rawManager.QueueActions(RawCommand(order.Unit.AbilityId, worker.Tag, target.Tag));
            return(true);
        }
Exemplo n.º 2
0
 private void HarvestGather(ulong target, params IUnit[] workers)
 => rawManager.QueueActions(
     new Action {
     ActionRaw = new ActionRaw {
         UnitCommand = new ActionRawUnitCommand {
             AbilityId     = GameConstants.RaceHarvestGatherAbility,
             TargetUnitTag = target,
             UnitTags      = { workers.Select(w => w.Tag).ToList() }
         }
     }
 });
Exemplo n.º 3
0
        /// <inheritdoc />
        public void Move(ulong unit, Point2D point, bool queue = false)
        {
            var command = new ActionRawUnitCommand {
                AbilityId           = BlizzardConstants.Ability.Move,
                QueueCommand        = queue,
                TargetWorldSpacePos = point,
                UnitTags            = { unit }
            };

            rawManager.QueueActions(new Action {
                ActionRaw = new ActionRaw {
                    UnitCommand = command
                }
            });
        }