예제 #1
0
        public MoveInfo MakeMove(State state)
        {
            var bestTactics = AvailableTactics
                              .Where(x => x.ShouldBeStarted(state))
                              .OrderBy(x => x.Priority)
                              .Last();

            if (CurrentTactics == null ||
                CurrentTactics.Priority < bestTactics.Priority ||
                !CurrentTactics.CanMove(state))
            {
                //CurrentTactics = bestTactics;
                bestTactics.Start(state, CurrentTactics);
                CurrentTactics = bestTactics;

                Log.Write("Выбрана новая тактика: " + bestTactics.GetType().Name);
            }


            var move = CurrentTactics.MakeMove(state);

            if (move != null)
            {
                InvokeOnMove(move, CurrentTactics);

                Log.Write("Сделан ход: " + move);
            }
            return(move);
        }
예제 #2
0
        public BaseStrategy()
        {
            AvailableTactics.Add(new DestroyTactics());
            AvailableTactics.Add(new DeadlyTactics());
            //AvailableTactics.Add(new ChargeTactics());
            //AvailableTactics.Add(new RollbackTactics(this));

            DefaultTactics = new DefaultTactics();
            AvailableTactics.Add(DefaultTactics);
        }
예제 #3
0
        public MinigunGordonStrategy()
        {
            var lt = new LinearTactics(ImportWayPoints("gordon/main"));

            DefaultTactics.AddInnerTactics(lt);
            DefaultTactics.Priority += 0.05;

            var alt3 = new DefaultTactics();
            var lt3  = new LinearTactics(ImportWayPoints("gordon/defensive"));

            alt3.AddInnerTactics(lt3);
            AvailableTactics.Add(alt3);
        }
예제 #4
0
        public SniperBobStrategy()
        {
            var lt = new LinearTactics(ImportWayPoints("bob/main"));

            DefaultTactics.AddInnerTactics(lt);
            //DefaultTactics.AddInnerTactics(new RotateTactics(lt.WayPoints.Last(), 0, 1));
            DefaultTactics.AddInnerTactics(new RotateTactics(lt.WayPoints.Last(), 0, null));
            DefaultTactics.Priority += 0.05;

            var alt2 = new DefaultTactics();
            var lt2  = new LinearTactics(ImportWayPoints("bob/second"));

            alt2.AddInnerTactics(lt2);
            alt2.AddInnerTactics(new RotateTactics(lt2.WayPoints.Last(), 0, null));
            AvailableTactics.Add(alt2);

            var alt3 = new DefaultTactics();
            var lt3  = new LinearTactics(ImportWayPoints("bob/defensive"));

            alt3.AddInnerTactics(lt3);
            alt3.AddInnerTactics(new RotateTactics(lt3.WayPoints.Last(), 0, null));
            AvailableTactics.Add(alt3);
        }