void OnLevelWasLoaded() { //if(GetComponent<NetworkView>().isMine){ bool works = false; int i = 0; while (!works) { map = ScriptableObject.CreateInstance("MazeMap") as MazeMap; map.initializeMap(step, tileSet); created = true; works = defineRooms(); } foreach (LinkedRoom r in map.rooms) { //map.initializeNeighborRooms (r); if (r.getRoom().getState() != "null") { GetComponent <NetworkView>().RPC("loadMap", RPCMode.AllBuffered, r.getRoom().toString(), i); i++; } } //} GameObject[] players = GameObject.FindGameObjectsWithTag("Player") as GameObject[]; foreach (GameObject p in players) { playerController control = p.GetComponent <playerController>() as playerController; control.enabled = true; } }
void Start() { bool works = false; Camera.main.enabled = true; //if(GetComponent<NetworkView>().isMine){ while (!works) { map = ScriptableObject.CreateInstance("MazeMap") as MazeMap; map.initializeMap(step, tileSet); map.onEnable(); //created = true; works = defineRooms(); } created = true; int i = 0; foreach (LinkedRoom r in map.rooms) { if (r.getRoom().getState() != "null") { //GetComponent<NetworkView>().RPC ("loadMap", RPCMode.AllBuffered, r.getRoom ().toString(),i); i++; } } //} // GameObject[] players = GameObject.FindGameObjectsWithTag ("Player") as GameObject[]; // foreach(GameObject p in players){ // playerController control = p.GetComponent<playerController>() as playerController; // control.enabled = true; // } }