Beispiel #1
0
 private int GetValue(FruitFunctions ff)
 {
     if (ff == FruitFunctions.Points)
     {
         int p = this.random.Next(0, 10);
         if (p >= 0 && p < 6)
         {
             return(10);
         }
         else if (p >= 6 && p < 8)
         {
             return(20);
         }
         else if (p == 8)
         {
             return(30);
         }
         else
         {
             return(-10);
         }
     }
     else if (ff == FruitFunctions.SnakeLenght)
     {
         int sl = this.random.Next(0, 10);
         if (sl >= 0 && sl < 6)
         {
             return(1);
         }
         else if (sl >= 6 && sl < 8)
         {
             return(2);
         }
         else
         {
             return(-1);
         }
     }
     else if (ff == FruitFunctions.Live)
     {
         int l = this.random.Next(0, 10);
         if (l >= 0 && l < 6)
         {
             return(1);
         }
         else if (l >= 6 && l < 8)
         {
             return(2);
         }
         else
         {
             return(-1);
         }
     }
     else
     {
         return(0);
     }
 }
Beispiel #2
0
 public Fruit(Point location, int size, Brush brush, FruitFunctions fruitFunctions, int value)
 {
     Location            = location;
     Size                = size;
     Brush               = brush;
     this.FruitFunctions = fruitFunctions;
     this.Value          = value;
 }
Beispiel #3
0
        private Fruit GetRandomFruit()
        {
            Point          p  = mainControler.GetRandomPoint();
            FruitFunctions ff = GetFruitFunction();
            int            i  = GetValue(ff);
            Brush          b  = GetBrush((int)ff);

            return(new Fruit(p, elementSize, b, ff, i));
        }