当前位置: 首页>>代码示例>>C#>>正文


C# PhotonPlayer.SetCustomProperties方法代码示例

本文整理汇总了C#中PhotonPlayer.SetCustomProperties方法的典型用法代码示例。如果您正苦于以下问题:C# PhotonPlayer.SetCustomProperties方法的具体用法?C# PhotonPlayer.SetCustomProperties怎么用?C# PhotonPlayer.SetCustomProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhotonPlayer的用法示例。


在下文中一共展示了PhotonPlayer.SetCustomProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCustomProperties

	// sets and syncs custom properties on a network player (including masterClient)
	private void SetCustomProperties(PhotonPlayer player, int car, int position) {
		ExitGames.Client.Photon.Hashtable customProperties = new ExitGames.Client.Photon.Hashtable() { { "spawn", position }, {"car", car} };
		player.SetCustomProperties(customProperties);
	}
开发者ID:fanfreeman,项目名称:FunCarMultiplayer,代码行数:5,代码来源:Menu.cs

示例2: GetShot

	public void GetShot(float damage, PhotonPlayer enemy){
		//Take Damage and check for death
		health -= damage;
		//Play a random Impact Sounds
		audio2.clip = fleshImpactSounds [Random.Range (0, 6)];
		audio2.Play ();
		Debug.Log ("<color=green>Got Shot with </color>" + damage + " damage. Is alive: " + alive + " PhotonView is" + photonView.isMine);
		//Once dead
		if(health <=0 && alive){
			
			alive = false; 
			Debug.Log ("<color=blue>Checking Health</color>" + health + " Photon State " + photonView.isMine + " Player Name " + PhotonNetwork.player.name);
			if (photonView.isMine) {

				//Only owner can remove themselves
				Debug.Log ("<color=red>Death</color>");
				if(SendNetworkMessage != null){
					if(damage < 100f)
						SendNetworkMessage(enemy.name + " owned " + PhotonNetwork.player.name + ".");
					if(damage == 100f)
						SendNetworkMessage(enemy.name + " headshot " + PhotonNetwork.player.name + "!");
						
				}
				//Subscribe to the event so that when a player dies 3 sec later respawn
				if(RespawnMe != null)
					RespawnMe(3f);

				//Create deaths equal to stored hashtable deaths, increment, Set
				int totalDeaths = (int)PhotonNetwork.player.customProperties["D"];
				totalDeaths ++;
				ExitGames.Client.Photon.Hashtable setPlayerDeaths = new ExitGames.Client.Photon.Hashtable() {{"D", totalDeaths}};
				PhotonNetwork.player.SetCustomProperties(setPlayerDeaths);

				//Increment Kill Count for the enemy player
                if(!(enemy.name == "DroneAI")){
				int totalKIlls = (int)enemy.customProperties["K"];
				totalKIlls ++;
				ExitGames.Client.Photon.Hashtable setPlayerKills = new ExitGames.Client.Photon.Hashtable() {{"K", totalKIlls}};
				Debug.Log ("<color=red>KillCounter Called at </color>" + totalKIlls);
				enemy.SetCustomProperties(setPlayerKills);

				//If we reach the kill limit by checking rooms custom property and if this is enabled
                if (totalKIlls == (int)(PhotonNetwork.room.customProperties["KL"]) && (int)(PhotonNetwork.room.customProperties["TKL"]) == 1)
                {
					//Display Win Screen
					NM.DisplayWinPrompt(enemy.name);
				}
               
				//Write Kills and Deaths to File On Death 
				//System.IO.File.AppendAllText (@"C:\Users\Public\PlayerStats.txt", "\n" + "KDR on Death: " + ((int)(PhotonNetwork.player.customProperties["K"])).ToString() + ":" + totalDeaths.ToString());
				//Write amount of ammo picked up so far until death. 
                //System.IO.File.AppendAllText(@"C:\Users\Public\PlayerStats.txt", "\n" + "Total Amount of ammmo picked up so far: " + pickedUpAmmo.ToString());
                }
				//Spawn ammo on death
				PhotonNetwork.Instantiate("Ammo_AK47",transform.position - new Vector3 (0,0.9f,0), Quaternion.Euler(1.5f,149f,95f),0);
				//Finally destroy the game Object.
				PhotonNetwork.Destroy(gameObject);
					
			}
		}
		//Play Hit Effect Animation for player getting hit. Without isMine would play for everyone. 
		if (photonView.isMine) {
			injuryAnim.SetBool ("Hit", true);
			StartCoroutine( WaitForAnimation (1.2f));
		}
	}
开发者ID:hamza765,项目名称:Kelpie5,代码行数:66,代码来源:PlayerNetworkMover.cs


注:本文中的PhotonPlayer.SetCustomProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。