示例#1
0
 public char SnekLetter(Vector2Int snakeMapPosition) //Has the snake consumed the food?
 {
     if (snakeMapPosition == DMapPosition)           //Collect D
     {
         Object.Destroy(d);                          //Break letter
         //FoodSpawner(); //make new food.
         SnakeManager.addScore();
         Debug.Log("Snake Ate letter D.");
         return('D');
     }
     else if (snakeMapPosition == GMapPosition) //Collect G
     {
         Object.Destroy(g);                     //Break letter
         SnakeManager.addScore();
         Debug.Log("Snake Ate letter G.");
         return('G');
     }
     else if (snakeMapPosition == SMapPosition) //Collect G
     {
         Object.Destroy(s);                     //Break letter
         SnakeManager.addScore();
         Debug.Log("Snake Ate letter S.");
         return('S');
     }
     else
     {
         return('N');
     }
 }
示例#2
0
 public bool SnekSneakSnekEat(Vector2Int snakeMapPosition) //Has the snake consumed the food?
 {
     if (snakeMapPosition == foodMapPosition)              //eat the food
     {
         Object.Destroy(thaFoood);                         //Break eaten food
         FoodSpawner();                                    //make new food.
         SnakeManager.addScore();
         Debug.Log("Snake Ate Food, making more!");
         return(true);
     }
     else
     {
         return(false);
     }
 }