示例#1
0
    void addplant(plantBluePrint thisPlant)
    {
        if (!buildManager.HasMoney)
        {
            Debug.Log("don't have enough money!");
            return;
        }
        playerStats.LightCount -= thisPlant.cost;        //应该修改为植物的价格。


        GameObject hp_bar = thisPlant.plantPrefeb;

        hp_bar = Instantiate(hp_bar, GetBuildPosition(), Quaternion.identity);

        //hp_bar.GetComponent<plantHealth> ().grass = gameObject; //一旦该植物被摧毁,将这个草地上的植物变量表示为空
        hp_bar.transform.parent = GetComponent <RectTransform> ();       //?????
        //Debug.Log (plants.GetComponent<plantHealth> ().health);
        plants = hp_bar;
    }
示例#2
0
 public void DeSelectPlant()
 {
     plantToBuild = null;
     Destroy(dragPic);
 }
示例#3
0
 public void SelectTurretToBuild(plantBluePrint plant)
 {
     plantToBuild = plant;
 }