Beispiel #1
0
	public void Awake()
	{
		time = Time.time;
		Loaded = false;
		mGen = GetComponent<MapGeneration> (); //new MapGeneration();
		pFind = GetComponent<AStar> ();
		photonView = GetComponent<PhotonView> ();
		seed = 0;
		if (PhotonNetwork.isMasterClient) {
			seed = Random.seed;
			for (int i = -4; i <= 4; ++i) {
				for(int j = -4; j <= 4; ++j){
					mGen.GenerateBlock (i, j, seed, 0, 0);
				}
			}
			mGen.CreateGrid(0, 0);
			Loaded = true;	
			lastX = 0;
			lastY = 0;
		}
		
		// in case we started this demo with the wrong scene being active, simply load the menu scene
		if (!PhotonNetwork.connected)
		{
			Application.LoadLevel(Menu.SceneNameMenu);
			return;
		}
		// we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate
		playerObject = PhotonNetwork.Instantiate(this.playerPrefab.name, transform.position, Quaternion.identity, 0);
		playerController = playerObject.GetComponent<ThirdPersonController> ();
	}