Beispiel #1
0
        public override void TestInitialize()
        {
            base.TestInitialize();
            coaches   = new TestRepository();
            entries   = new TestTimetableEntriesRepository();
            trainings = new TestTrainingsRepository();
            locations = new TestLocationsRepository();
            types     = new TestTrainingTypesRepository();
            data      = GetRandom.Object <CoachData>();
            var c = new Coach(data);

            coaches.Add(c).GetAwaiter();
            trainingData = GetRandom.Object <TrainingData>();
            var t = new Training(trainingData);

            trainings.Add(t).GetAwaiter();
            trainingTypeData = GetRandom.Object <TrainingTypeData>();
            var tt = new TrainingType(trainingTypeData);

            types.Add(tt).GetAwaiter();
            locationData = GetRandom.Object <LocationData>();
            var l = new Location(locationData);

            locations.Add(l).GetAwaiter();
            obj = new TestClass(coaches, entries, trainings, locations, types);
        }
Beispiel #2
0
        public static TrainingType Create(TrainingTypeView v)
        {
            var d = new TrainingTypeData();

            Copy.Members(v, d);

            return(new TrainingType(d));
        }
        public static Domain.TrainingType.TrainingType Create(TrainingTypeView view)
        {
            var d = new TrainingTypeData();

            Copy.Members(view, d);

            return(new Domain.TrainingType.TrainingType(d));
        }
Beispiel #4
0
 public List <SC2APIProtocol.Action> MorphBuilding(MacroData macroData, TrainingTypeData unitData)
 {
     if ((unitData.Food == 0 || unitData.Food <= macroData.FoodLeft) && unitData.Minerals <= macroData.Minerals && unitData.Gas <= macroData.VespeneGas)
     {
         var building = ActiveUnitData.Commanders.Where(c => unitData.ProducingUnits.Contains((UnitTypes)c.Value.UnitCalculation.Unit.UnitType) && !c.Value.UnitCalculation.Unit.IsActive && c.Value.UnitCalculation.Unit.BuildProgress == 1);
         if (building.Count() > 0)
         {
             return(building.First().Value.Order(macroData.Frame, unitData.Ability));
         }
     }
     return(null);
 }
Beispiel #5
0
        public List <Action> BuildAddOn(MacroData macroData, TrainingTypeData unitData, Point2D location = null, float maxDistance = 50)
        {
            if (unitData.Minerals <= macroData.Minerals && unitData.Gas <= macroData.VespeneGas)
            {
                var building = ActiveUnitData.Commanders.Where(c => unitData.ProducingUnits.Contains((UnitTypes)c.Value.UnitCalculation.Unit.UnitType) && !c.Value.UnitCalculation.Unit.IsActive && c.Value.UnitCalculation.Unit.BuildProgress == 1 && !c.Value.UnitCalculation.Unit.HasAddOnTag);
                if (building.Count() > 0)
                {
                    if (location != null)
                    {
                        building = building.Where(b => Vector2.DistanceSquared(new Vector2(location.X, location.Y), b.Value.UnitCalculation.Position) <= maxDistance * maxDistance);
                    }
                    if (building.Count() > 0)
                    {
                        var action = building.First().Value.Order(macroData.Frame, unitData.Ability);
                        if (action != null)
                        {
                            return(action);
                        }
                    }
                }
            }

            return(null);
        }