Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Procedural Content Generation for Unity Game Development

You're reading from   Procedural Content Generation for Unity Game Development Harness the power of procedural content generation to design unique games with Unity

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785287473
Length 260 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ryan Watkins Ryan Watkins
Author Profile Icon Ryan Watkins
Ryan Watkins
Arrow right icon
View More author details
Toc

GameManager


There are some small updates that we need to add to the GameManager class so that we can connect the Dungeon Board data to the BoardManager and Player classes. The GameManager class will use some driver functions to pass information to and from the different classes and initiate the dungeon generation. The update is shown in Code Snip 4.9:

16 private DungeonManager dungeonScript;
17 private Player playerScript;
…
22 void Awake() {
23  if (instance == null)
24    instance = this;
25  else if (instance != this)
26    Destroy(gameObject);
27    
28  DontDestroyOnLoad(gameObject);
29    
30  enemies = new List<Enemy>();
31
32  boardScript = GetComponent<BoardManager> ();
33
34  dungeonScript = GetComponent<DungeonManager> ();
35  playerScript = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
36    
37  InitGame();
38 }
…
116 public void enterDungeon () {
117   dungeonScript.StartDungeon ();
118   boardScript.SetDungeonBoard (dungeonScript...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime