Esempio n. 1
0
 //after clicking on the bomb sprite, the car selected gets destroyed
 public void detectBombAndCar()
 {
     //if bomb can be used and has been selected
     if (myGameManager.bombActive() == true && bombClicked == true)
     {
         Vector3 oldCarLocation = myGameManager.getSelectedCar().transform.position;
         //destroy the gameobject
         Destroy(myGameManager.getSelectedCar());
         //remove car position from hashset
         int newLeftXLoc  = (int)(oldCarLocation.x + leftOffset);
         int newRightXLoc = (int)(oldCarLocation.x + rightOffset);
         myMap.removeCars(newLeftXLoc, (int)oldCarLocation.y);
         myMap.removeCars(newRightXLoc, (int)oldCarLocation.y);
         //remove driver
         myGameManager.driver.GetComponent <Renderer>().enabled = false;
         //turn off bomb
         myGameManager.bomb.SetActive(false);
     }
 }