Buying items, watching adverts, and preparing to start a game
In this section, we will look at adding three more buttons to our shop scene. The first is BUY?
for when we want to purchase an item. The second is Watch Ad
—as soon as the player presses this button, an advert will load; once it's finished, the player is rewarded with 300
credits. Lastly, we'll add the START
button, which will take the player to the testLevel
scene with the upgrades they have purchased (if any).
We need to head back to the PlayerShipBuild
script and scroll down to the AttemptSelection
method, where we will add three else if
statements to launch three different types of methods. The reason for this is that the three selections don't follow on from the scriptable object buttons; therefore, these items will never have outcomes such as SOLD
or itemText
.
The following screenshot shows the complete AttemptSelection
method with the focus drawn to the other three non-scriptable object...