Beispiel #1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (this.gameObject.tag == "FOOD")
     {
         if (collision.gameObject.name == "snakeBody")
         {
             ScoreManager_Access.PlayerScore += ScoreManager_Access.scoreValue;
             SnakeClass_Access.CreateSnakeGrid();
             ScoreManager_Access.PreviousFood = FoodClass_Access.currentFoodType;
             FoodClass_Access.SpawnFood();
             ScoreManager_Access.currentFood = FoodClass_Access.currentFoodType;
             Destroy(gameObject);
         }
     }
     if (this.gameObject.tag == "Edge")
     {
         if (collision.gameObject.name == "snakeBody")
         {
             gamecontrol_Access.gameOver = true;
         }
     }
     if (this.gameObject.tag == "SNAKE")
     {
         if (Timer > 1)
         {
             if (collision.gameObject.name == "snakeBody")
             {
                 gamecontrol_Access.gameOver = true;
             }
         }
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     snakeClass_Access.InitilaliseSnake();
     FoodClass_Access.SpawnFood();
     ScoreManager_Access.InitScore();
 }