Beispiel #1
0
 public void spawnTower1()
 {
     if (castle.canPurchase(200))
     {
         Debug.Log("spawnTower1() triggered");
         currentTower = buildingPlacement.SetItem(buildings[0]);
         castle.makePurchase(200);
         lastPurchaseAmount = 200;
         initOnce           = false;
     }
     else
     {
         // TODO Produce an alert that says you cannot make that purchase
     }
 }
Beispiel #2
0
 public void setPrice(int cost)
 {
     if (castle.canPurchase(cost))
     {
         GameObject.Find("Cost").GetComponent <Text> ().text =
             "$" + cost;
         GameObject.Find("Cost").GetComponent <Text> ().color = Color.white;
     }
     else
     {
         Debug.Log("New price: " + price);
         GameObject.Find("Cost").GetComponent <Text> ().text =
             "$" + cost;
         GameObject.Find("Cost").GetComponent <Text> ().color = Color.red;
     }
 }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     castle = GameObject.Find("Castle").GetComponent <CastleHealth>();
     //GetComponent<Canvas> ().enabled = false;
     GameObject.Find("TrainingWindow").GetComponent <Canvas>().enabled = false;
     GameObject.Find("TrainButton").GetComponent <Button> ()
     .onClick.AddListener(delegate {
         if (castle.canPurchase(price))
         {
             train();
             GetComponent <Canvas> ().enabled = false;
         }
         else if (!castle.canPurchase(price))
         {
             Debug.Log("Not enough money");
         }
         else if (getTotalUnits() == 0)
         {
             Debug.Log("No units to train!");
         }
     });
 }
 // Use this for initialization
 void Start()
 {
     castle = GameObject.Find("Castle").GetComponent<CastleHealth>();
     //GetComponent<Canvas> ().enabled = false;
     GameObject.Find("TrainingWindow").GetComponent<Canvas>().enabled = false;
     GameObject.Find ("TrainButton").GetComponent<Button> ()
         .onClick.AddListener (delegate {
             if(castle.canPurchase(price)) {
                 train();
                 GetComponent<Canvas> ().enabled = false;
             } else if(!castle.canPurchase(price)) {
                 Debug.Log("Not enough money");
             } else if(getTotalUnits() == 0) {
                 Debug.Log("No units to train!");
             }
         });
 }