コード例 #1
0
        private void CheckForNewUnits()
        {
            foreach (var facilityUnit in FreeUnitsOnFacilities)
            {
                var unitsOnFactoryCount = facilityUnit.Value.Count();
                var facility            = facilityUnit.Key;

                var timeToCreateSquad = SquadIdGenerator.HasCapacity &&
                                        (unitsOnFactoryCount >= MaxUnitsForNewSquad ||
                                         (facility.CapturePoints < 10 && unitsOnFactoryCount > 10) ||
                                         (facility.VehicleType == null && unitsOnFactoryCount > 10));

                if (timeToCreateSquad)
                {
                    var factoryRange = GetFacilityRange(facility);
                    Universe.Print($"Creating new squad on factory [{facility.Id}]");
                    ActionList.ActionSelectInRange(factoryRange);
                    ActionList.ActionCreateNewSquadAlreadySelected(SquadList, SquadIdGenerator);
                    return; // Once created
                }
            }
        }