示例#1
0
        public void FireOnInvadersDecreasesInvadersHealth()
        {
            var map  = new Map(3, 3);
            var path = new Path(new MapLocation[] {
                new MapLocation(0, 0, map),
                new MapLocation(0, 0, map),
                new MapLocation(0, 0, map)
            }
                                );

            var target = new Tower(new MapLocation(2, 1, map), map, path);

            var invaders = new BasicInvader[]
            {
                new BasicInvader(path),
                new BasicInvader(path)
            };

            var expected = new BasicInvader(path).Health - target.Power;

            foreach (IInvader invader in invaders)
            {
                var startingHealth = invader.Health;
                while (invader.Health == startingHealth)
                {
                    target.FireOnInvaders(invader);
                }
            }

            Assert.All(invaders, i => Assert.Equal(expected, i.Health));
        }
示例#2
0
 // Builds constructor.
 // Takes one parameter,
 // an object from the class Path.
 // Constructor is called as soon
 // as an object(instance) of the
 // class is declared.
 public ResurrectingInvader(Path path)
 {
     // Builds object from the BasicInvader class.
     // Constructor takes one parameter.
     // Stores output in the variable _incarnation1.
     _incarnation1 = new BasicInvader(path);
     // Builds object from the StrongInvader class.
     // Constructor takes one parameter.
     // Stores output in the variable _incarnation2.
     _incarnation2 = new StrongInvader(path);
 }
示例#3
0
 public ResurrectingInvader(Path path)
 {
     _incarnation1 = new BasicInvader(path);
     _incarnation2 = new StrongInvader(path);
 }
 public ResurrectedInvader(Path path)
 {
     _resurrectedInvader1 = new BasicInvader(path);
     _resurrectedInvader2 = new StrongInvader(path);
 }
示例#5
0
 public RessurectingInvader(Path path)
 {
     _incarnation1 = new BasicInvader(path);
     _incarnation2 = new GuardianInvader(path);
 }
示例#6
0
 public ResurrectingInvader(Path path)
 {
     _regeneration1 = new BasicInvader(path);
     _regeneration2 = new StrongArmedInvader(path);
 }