public void InRangeOfWithRange1() { var map = new Map(3, 3); var target = new MapLocation(0, 0, map); Assert.True(target.InRangeOf(new MapLocation(0, 1, map), 1)); }
public void InRangeOfWithToSmallRange() { var map = new Map(6, 6); var target = new MapLocation(0, 0, map); Assert.False(target.InRangeOf(new MapLocation(0, 5, map), 4)); }
public void FireOnInvaders(Invader[] invaders) { // for (int i = 0; i < indavers.Length; i++) { // // do stuff w/invader // } foreach (Invader invader in invaders) { // do stuff w/invader if (invader.IsActive && _location.InRangeOf(invader.Location, _range)) { if (IsSuccessfulShot()) { invader.DecreaseHealth(_power); Console.WriteLine("Shot and hit invader!") if (invader.IsNeutralized) { Console.WriteLine("Neutralized!") } } else { Console.WriteLine("Shot and missed invader!") } break; } } }
public void In_Range_Of_With_Range_1() { var map = new Map(3, 3); var target = new MapLocation(0, 0, map); Assert.IsTrue(target.InRangeOf(new MapLocation(0, 1, map), 1)); }
public void FireOnInvaders(Invader[] invaders) { foreach (Invader invader in invaders) { // do stuff if (invader.IsActive && _location.InRangeOf(invader.Location, _range)) { if (IsSuccessfulShot()) { invader.DecreaseHealth(_power); System.Console.WriteLine("Shot and hit an invader!"); if (invader.IsNeutralized) { System.Console.WriteLine("Neutralized this invader!!!! :D"); } } else { System.Console.WriteLine("Missed :("); } break; } } }
//towers are made to shoot public void FireOnInvaders(IInvader[] invaders) { foreach (IInvader invader in invaders) { if (invader.IsActive && _location.InRangeOf(invader.Location, Range)) { if (IsSuccessfulShot()) { invader.DecreaseHealth(Power); System.Console.WriteLine("Shot and hit invader at" + invader.Location); if (invader.IsNeutralized) { System.Console.Write("Invader nuetralized"); } } else { System.Console.WriteLine("Shot and miss invader"); } break; } } }
//public void InRangeOfTest() public void InRangeOfWithRange1() { var map = new Map(3, 3); var target = new MapLocation(0, 0, map); Assert.True(target.InRangeOf(new MapLocation(0, 1, map), 1)); //Assert.True(false, "This test needs an implementation"); }
public void FireOnInvaders(IInvader[] invaders) { foreach (IInvader invader in invaders) { if (invader.IsActive && _location.InRangeOf(invader.Location, Range)) { invader.DecreaseHealth(Power); } } }
public void InRangeOfTest() { //Arrange var map = new Map(3, 3); var sut = new MapLocation(1, 1, map); //Act var result = sut.InRangeOf(new MapLocation(2, 2, map), 2); //Assert result.ShouldBeTrue(); }
public void FireOnInvaders(Invader[] invaders) { foreach (Invader invader in invaders) { if (invader.IsActive && _location.InRangeOf(invader.Location, 1)) { invader.DecreaseHealth(1); break; } } }
public void FireOnInvaders(IInvader[] invaders) { foreach (IInvader invader in invaders) { if (invader.IsActive && _location.InRangeOf(invader.Location, Range)) { if (IsSuccessfulShot()) { invader.DecreaseHealth(Power); if (invader.IsNeutralized) { Console.WriteLine($"Neutralized an invader at {invader.Location}!"); } } else { Console.WriteLine("Shot at and missed an invader."); } break; } } }
public void FireOnInvaders(Invader[] invaders) { foreach (Invader invader in invaders) { if (invader.IsActive && _location.InRangeOf(invader.Location, _range)) { if (IsSuccessfulShot()) { invader.DecreaseHealth(_power); Console.WriteLine("Shot at and hit an invader!"); if (Invader.IsNeutralized) { Console.WriteLine("Invader is Neutralized") } break; } else { Console.WriteLine("Shot at and missed an invader") } } } }
public void FireOnInvaders(IInvader[] invaders) { foreach (IInvader invader in invaders) { //Do Stuff if (invader.IsActive && _location.InRangeOf(invader.Location, Range)) { if (IsSuccessfulShot()) { invader.DecreaseHealth(Power); if (invader.IsNeutralized) { System.Console.WriteLine("He GONE! Invader was shot down at " + invader.Location); } } else { System.Console.WriteLine("Missed... "); } break; } } }
/// <summary> /// Checks if <c>Tower</c> is in range of /// <c>Invader</c> passed as argument. /// /// Method <c>InRangeOf</c> defined in /// <c>MapLocation</c> is used upon /// <c>_location</c> field with <c>Tower.Range</c> /// </summary> /// <param name="invader"></param> /// <returns> /// <c>true</c> if invader is /// in <c>Tower.Range</c> /// </returns> public bool IsInRangeOf(Invader invader) => _location.InRangeOf(invader.Location, Range);