Exemplo n.º 1
0
 public void BuyShip()
 {
     if (playerShip != null)
     {
         //If the player has enough sol
         if (gameWorldControl.GetSol() >= shipCost)
         {
             gameWorldControl.SubtractSol(shipCost);
             //Enable PlayerControl and PlayerFlight
             playerShip.GetComponent <PlayerController>().enabled = true;
             playerShip.GetComponent <PlayerFlight>().enabled     = true;
             if (playerShip.GetComponent <Mining>() != null)
             {
                 playerShip.GetComponent <Mining>().enabled = true;
             }
             //Make the Ship Selection Panel inactive
             NGUITools.SetActive(gameObject, false);
             //Send the global GameWorldControl script the player ship
             gameWorldControl.SendMessage("SetPlayerShip", playerShip);
             //Add the player ship to the game controller ship array
             playerShipArray.SendMessage("AddPlayer", playerShip);
         }
         else
         {
             NGUITools.SetActive(notEnoughSolObject, true);
         }
     }
 }