Example #1
0
 public override void UseItem(Snake snake)
 {
     base.UseItem(snake);
     snake.TimeLeft    += 100;
     snake.TimesToGrow += 1;
     snake.AddPoints(1);
     if (Configerator.instance.ActiveLevel != null && Configerator.instance.ActiveLevel.EnemySnakeEnabled)
     {
         WorldRenderer.instance.World.snake.CurrentFoodUnit          =
             WorldRenderer.instance.World.enemySnake.CurrentFoodUnit =
                 CreateNewFoodUnit();
     }
     else
     {
         snake.CurrentFoodUnit = CreateNewFoodUnit();
     }
     //if the food spawned on the snake, spawn it again
     while (snake.BodyParts.Contains(snake.CurrentFoodUnit.Location()) ||
            snake.HeadPosition == snake.CurrentFoodUnit.Location() ||
            snake.NewHeadPosition == snake.CurrentFoodUnit.Location())
     {
         allItems.Remove(snake.CurrentFoodUnit);
         snake.CurrentFoodUnit = CreateNewFoodUnit();
     }
 }
Example #2
0
 public override void UseItem(Snake snake)
 {
     base.UseItem(snake);
     snake.AddPoints(pointsToAdd);
 }