Beispiel #1
0
 public void plantClicked() //used by the unity button script that is on each plant tile
 {
     if (PlantGrowing)      //if there is a plant gorwin on this tile, the player either waters it or collects a fully grown plant
     {
         if (PlantDone)     //collect coins
         {
             //give the player coins accoring to the plant type and the coin bonus from rocks
             //(the bonus is added to the base reward by multiplying the plant reward with the rock bonus and dividing it all to try and balance the reward boost from rocks)
             coinScript.collectCoins((PlantedPlant.getReward() + ((PlantedPlant.getReward() * rockHandlerScript.getCoinRewardBonus()) / 2)), this.gameObject.GetComponent <Transform>().position);
             PlantSprite.sprite     = DirtSprite;//clears the tile since the plant has been harvested
             PlantGrowing           = false;
             WaterBarImg.fillAmount = 0;
         }
         else
         {
             waterPlant(); //set the water bar back to full
         }
     }
     else if (seedHandlerScript.seedCheck())
     {
         setupPlant();                                   //if this tile is empty check if the player is holding a valid seed to plant and plant it
     }
 }