Exemplo n.º 1
0
        private IUnit GetWorker(IPosition position)
        {
            position = position ?? intelManager.PrimaryColony;
            var worker = position.GetClosest(intelManager.WorkersSelf().Where(o => o.Orders.Count == 0));

            if (worker != null)
            {
                worker.Orders.Add(new UnitOrder {
                });                                   // Add decoy order to prevent it from being used this frame.
                return(worker);
            }
            var minerals = intelManager.MineralFields.Select(mf => mf.Tag);

            return(worker = position.GetClosest(intelManager.WorkersSelf().Where(o => o.Orders.Count == 1 && minerals.Contains(o.Orders.First().TargetUnitTag))));
        }