示例#1
0
    public int CompareTo(IInvader other)
    {
        var compare = this.Distance.CompareTo(other.Distance);

        if (compare == 0)
        {
            return(other.Damage.CompareTo(this.Damage));
        }

        return(compare);
    }
示例#2
0
    public int CompareTo(IInvader other)
    {
        int compareResult = this.Distance.CompareTo(other.Distance);

        if (compareResult == 0)
        {
            compareResult = this.Damage.CompareTo(other.Damage);
        }

        return(compareResult);
    }
示例#3
0
 public int CompareTo(IInvader other)
 {
     if (this.Distance < other.Distance)
     {
         return(-1);
     }
     else if (this.Distance > other.Distance)
     {
         return(1);
     }
     return(0);
 }
示例#4
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));
        }
    }
示例#5
0
 // 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);
            }
        }
示例#7
0
 public int CompareTo(IInvader other)
 {
     throw new NotImplementedException();
 }