Пример #1
0
        public static void ActionAppointNewScout(this Queue <IMoveAction> moveActions, List <Squad> squadList,
                                                 IdGenerator squadIdGenerator)
        {
            if (squadIdGenerator.HasCapacity)
            {
                const VehicleType type = VehicleType.Fighter;
                var scoutOwner         = squadList.FirstOrDefault(sq => sq.Units.Any(u => u.Type.Equals(type)) && !sq.IsScout);

                if (scoutOwner == null)
                {
                    return;
                }

                var candidateList = scoutOwner.Units.Where(u => u.Type == type).ToList();

                var scout = candidateList.GetMostDistantUnit();

                moveActions.Enqueue(new ActionSelectOneUnit(scout));
                foreach (var groupId in scout.Groups)
                {
                    moveActions.Enqueue(new ActionDismissSelectionFromSquad(groupId));
                }

                var newSquad = moveActions.ActionCreateNewSquadAlreadySelected(squadList, squadIdGenerator);
                newSquad.IsScout = true;
            }
        }
Пример #2
0
        public static void ActionCombineSquads(this Queue <IMoveAction> moveActions, List <Squad> squadList, Squad squadAlfa, Squad squadDelta, IdGenerator idGenerator, bool disableOld = true)
        {
            moveActions.ActionSelectSquad(squadAlfa.Id);
            moveActions.ActionAddSquadToCurrentSelection(squadDelta.Id);
            var newSquad = moveActions.ActionCreateNewSquadAlreadySelected(squadList, idGenerator);

            if (disableOld)
            {
                squadAlfa.Disable();
                squadDelta.Disable();
            }
            else
            {
                newSquad.Disable();
            }
        }