February 2017
Beginner
478 pages
11h 5m
English
If you remember, all the trading operations have a selected tower to deal with. In fact, when the player presses the sell button, the game should know which cupcake tower the player intends to sell. As such, the player should be able to select (and unselect) a tower, and this tower should notify the trading system.
To achieve this, we need to slightly modify the CupcakeTowerScript. From the previous section, we know that when the tower is active, it has a collider to prevent placing other towers on top of it as well. But, we can also use this collider to detect if the player clicks on this very specific tower. In particular, we can use the self-explanatory function, OnMouseDown() in the following way:
//Function called when ...Read now
Unlock full access