public int CompareTo(IInvader other) { var compare = this.Distance.CompareTo(other.Distance); if (compare == 0) { return(other.Damage.CompareTo(this.Damage)); } return(compare); }
public int CompareTo(IInvader other) { int compareResult = this.Distance.CompareTo(other.Distance); if (compareResult == 0) { compareResult = this.Damage.CompareTo(other.Damage); } return(compareResult); }
public int CompareTo(IInvader other) { if (this.Distance < other.Distance) { return(-1); } else if (this.Distance > other.Distance) { return(1); } return(0); }
public int CompareTo(IInvader other) { int distanceCompare = this.Distance.CompareTo(other.Distance); if (distanceCompare != 0) { return(distanceCompare); } else { return(other.Damage.CompareTo(this.Damage)); } }
// FireOnInvaders overload for unit testing public void FireOnInvaders(IInvader invader) { if (IsSuccessfulShot()) { invader.DecreaseHealth(Power); //Console.WriteLine($"SUCCESS : Shot and hit {invader.GetType().Name}!"); Console.Write($"|x|"); if (invader.IsNeutralized) { Console.WriteLine($"\n+1EXP : {invader.Honorific} neutralized!\n"); } } else { Console.Write("|o|"); } }
private void GenerateInvaderAndLevels() { int nInvaders = _amountInvaders[(int)Difficulty]; int nLevels = _amountLevels[(int)Difficulty]; // generate Levels for (int i = 0; i < nLevels; i++) { // generate Invaders Invaders = new IInvader[nInvaders + i]; for (int j = 0; j < (nInvaders + i); j++) { Invaders[j] = GetRandomInvader(); } Level level = new Level(Invaders); Levels.Add(level); } }
public int CompareTo(IInvader other) { throw new NotImplementedException(); }