In this section, we will implement the victory condition for the Cucumber Man. The only victory condition for the Cucumber Man is when the number of Cucumber Beetles is zero. Our
BeetleManager script already provides functionality for counting Cucumber Beetles. As you will recall, that is how we update our Cucumber Beetle count on our HUD. We will make some modifications to that script and create a new script in this section.
Let's start by creating an onscreen text component to display
You Won! when the number of Cucumber Beetles reaches zero. Here are the steps:
- Right-click an empty area of the
- In the
Inspectorpanel, rename the new GameObject to
EndofGame. We will use this as a container for our victory and defeat text labels.
- In the
Hierarchypanel, drag the
EndofGameGameObject to subordinate it to our
- With the
EndofGameGameObject selected, in the
Inspectorpanel, select the
Transformdropdown and click
Reset. This resets...