Пример #1
0
        public void StraightUnbuffered()
        {
            var pattern  = new StraightPattern(stopSearchLayer: Layers.WALL);
            var provider = new UnbufferedTargetProvider(pattern, Layers.REAL, Faction.Any);
            var entity   = World.Global.SpawnEntity(entityFactory, new IntVector2(0, 0));
            var target   = provider.GetTargets(new IntVector2(3, 0), new IntVector2(-1, 0)).Single();

            Assert.AreSame(target.transform, entity.GetTransform());
            var wall  = World.Global.SpawnEntity(wallFactory, new IntVector2(1, 0));
            int count = provider.GetTargets(new IntVector2(3, 0), new IntVector2(-1, 0)).Count();

            Assert.AreEqual(count, 0);
        }
Пример #2
0
        public void ProviderPredictionWorks()
        {
            var pattern  = new StraightPattern(Layers.WALL);
            var provider = new UnbufferedTargetProvider(pattern, Layers.REAL, Faction.Any);

            // Generating predictions relative to this point
            var info = new PredictionTargetInfo(Layers.REAL, Faction.Player);

            var positions = provider.PredictPositions(IntVector2.Zero, IntVector2.Right, info);

            Assert.AreEqual(2, positions.Count());

            var wall = World.Global.SpawnEntity(Wall.Factory, new IntVector2(1, 0));

            positions = provider.PredictPositions(IntVector2.Zero, IntVector2.Right, info);

            Assert.AreEqual(0, positions.Count());

            wall.GetTransform().ResetPositionInGrid(new IntVector2(2, 0));
            positions = provider.PredictPositions(IntVector2.Zero, IntVector2.Right, info);

            Assert.AreEqual(1, positions.Count());
        }
Пример #3
0
 public TargetProviderAction(UnbufferedTargetProvider provider, Attack attack, Push push)
 {
     _provider = provider;
     _attack   = attack;
     _push     = push;
 }