Game Development Reference
In-Depth Information
public int currRound = 1;
private TextMesh roundDisplayMesh = null;
void Start ()
{
roundDisplayMesh = gameObject.GetComponent<TextMesh>();
currRound = 1;
roundDisplayMesh.text = "Round: " + currRound.ToString();
}
void OnEnable()
{
BossEventController.bossDied += increaseRound;
}
void OnDisable()
{
BossEventController.bossDied -= increaseRound;
}
void increaseRound(int ignore)
{
currRound += 1;
roundDisplayMesh.text = "Round: " + currRound.ToString();
}
}
Now, whenever you defeat the boss, the round will increase by one. Let's use that
same round number to make things more difficult for the player. In the Text Mesh
field of the Round object, name its tag RoundWatcher .
If you don't remember how to set up tags, we'll remind you; they're easy! Just click
on the Tag drop-down menu in the Inspector panel, add a new tag, and then
go back to the object and select the tag in the drop-down menu.
Open up EnemyControllerScript and add the following code at the bottom of the
Start() function:
// Find the round watcher object
GameObject roundWatcherObject = GameObject.FindGameObjectWithT
ag("RoundWatcher");
if (roundWatcherObject != null)
{
 
Search WWH ::




Custom Search