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


C# NetworkPlayer类代码示例

本文整理汇总了C#中NetworkPlayer的典型用法代码示例。如果您正苦于以下问题:C# NetworkPlayer类的具体用法?C# NetworkPlayer怎么用?C# NetworkPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: OnPlayerDisconnected

	//Server function
	void OnPlayerDisconnected(NetworkPlayer player)
	{
		addGameChatMessage("Player disconnected from: " + player.ipAddress + ":" + player.port);
		
		//Remove player from the server list
		playerList.Remove(GetPlayerNode(player));
	}
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:8,代码来源:GUILogTransform_scripts_.cs

示例2: PlayerSwap

    void PlayerSwap(int newMode, NetworkPlayer player)
    {
        // find the player
        foreach (PlayerInfo p in nvs.players)
        {
            if (p.player==player) {
                p.currentMode = newMode;
                if (p.currentMode==0) {			// if they're now in a buggy
                    // set them in buggy
                    p.characterGameObject.transform.parent = p.cartGameObject.transform;
                    p.characterGameObject.transform.localPosition = new Vector3(0,0,0);
                    p.characterGameObject.transform.rotation = p.cartGameObject.transform.rotation;
                    // unlock golf ball
                    p.ballGameObject.rigidbody.constraints = RigidbodyConstraints.None;
                    // change animation
                    p.characterGameObject.transform.FindChild("lil_patrick").animation.Play("driveIdle",PlayMode.StopAll);

                } else if (p.currentMode==1) {	// if they're now at golf ball
                    // set them at golf ball
                    p.characterGameObject.transform.parent = p.ballGameObject.transform;
                    p.ballGameObject.transform.rotation = Quaternion.identity;		// reset rotation to make it nice
                    p.characterGameObject.transform.localPosition = new Vector3(0,0,-2);
                    p.characterGameObject.transform.rotation = Quaternion.identity;
                    // lock golf ball
                    p.ballGameObject.rigidbody.constraints = RigidbodyConstraints.FreezeAll;
                    // change animation
                    p.characterGameObject.transform.FindChild("lil_patrick").animation.Play("golfIdle",PlayMode.StopAll);
                }

                // reset keyboard buffer
                p.h = 0f;
                p.v = 0f;
            }
        }
    }
开发者ID:RestingCoder,项目名称:bad-golf-community-edition,代码行数:35,代码来源:controlServer.cs

示例3: DisconnectPlayer

    void DisconnectPlayer(NetworkPlayer player)
    {
        if(Network.isClient)
        {
            Debug.Log("Player Disconnected: " + player.ToString());
        }

        // now we have to do the reverse lookup from
        // the NetworkPlayer --> GameObject
        // this is easy with the Hashtable

        if(players.ContainsKey(player))
        {
            // we check to see if the gameobject exists
            // or not first just as a safety measure
            // trying to destory a gameObject that
            // doesn't exist causes a runtime error

            if((GameObject)players[player]) {
                Destroy((GameObject)players[player]);
            }

            // we also have to remove the Hashtable entry

            players.Remove(player);
        }
    }
开发者ID:Game-Group,项目名称:dog-fighter,代码行数:27,代码来源:networkController.cs

示例4: OnPlayerDisconnected

    void OnPlayerDisconnected(NetworkPlayer player)
    {
        //Debug.Log("Clean up after player " + player);

        foreach(CurrentPlayer script in playerScripts){
            if(player == script.owner){//We found the players object
                Network.RemoveRPCs(script.gameObject.networkView.viewID);//remove the bufferd SetPlayer call
                Network.Destroy(script.gameObject.networkView.viewID);//Destroying the GO will destroy everything
                playerList.Remove(script.owner);
                playerScripts.Remove(script);//Remove this player from the list

                break;
            }
        }

        //Remove the buffered RPC call for instantiate for this player.
        int playerNumber = int.Parse(player+"");
        Network.RemoveRPCs(player , 1);
        //Debug.Log(playerNumber);

        // The next destroys will not destroy anything since the players never
        // instantiated anything nor buffered RPCs
        //Network.RemoveRPCs(player);
        Network.DestroyPlayerObjects(player);
    }
开发者ID:xinlut1990,项目名称:LunarLander,代码行数:25,代码来源:Players.cs

示例5: deletePlayer

 public void deletePlayer(NetworkPlayer player)
 {
     GameObject go = (GameObject) players[player];
     Network.RemoveRPCs(go.networkView.viewID);
     Network.Destroy(go);
     players.Remove(player);
 }
开发者ID:Gerb11,项目名称:Unity,代码行数:7,代码来源:ServerPlayerManager.cs

示例6: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     collided = true;
     if (other.isTrigger ==  false){
         colliderNetworkPlayer = ((CurrentPlayer)other.GetComponent(typeof(CurrentPlayer))).owner;
     }
 }
开发者ID:xinlut1990,项目名称:LunarLander,代码行数:7,代码来源:Collidable.cs

示例7: OnPlayerConnected

    void OnPlayerConnected(NetworkPlayer player)
    {
        if (Network.isServer)
        {

        }
    }
开发者ID:hellwilliam,项目名称:DonkeyKongRemake,代码行数:7,代码来源:CharacterSelection.cs

示例8: CreatePlayerShip

    public static void CreatePlayerShip(NetworkPlayer target, Player player, int objectID)
    {
        if (StopSend())
            return;

        Channel.networkView.RPC("CreatePlayerShipRPC", target, player.ID, objectID);
    }
开发者ID:Game-Group,项目名称:dog-fighter,代码行数:7,代码来源:PlayerShipRPC.cs

示例9: GetMyTeamHP

 public float[] GetMyTeamHP(NetworkPlayer me, out int team)
 {
     //if(team == 0) {
     for(int i=0; i<m_teamOnePlayers.Count; i++) {
         //Debug.Log ("Running through team");
         if(m_teamOnePlayers[i] == me) {
             team = 0;
             float[] temp = m_teamOneHealth.ToArray();
             temp[0] = m_teamOneHealth[i];
             temp[i] = m_teamOneHealth[0];
             return temp;
         }
     }
     //}
     //if(team == 1) {
     for(int i=0; i<m_teamTwoPlayers.Count; i++) {
         if(m_teamTwoPlayers[i] == me) {
             team = 1;
             float[] temp = m_teamTwoHealth.ToArray();
             temp[0] = m_teamTwoHealth[i];
             temp[i] = m_teamTwoHealth[0];
             return temp;
         }
     }
     //}
     team = -1;
     return null;
 }
开发者ID:shawnmiller,项目名称:Capstone,代码行数:28,代码来源:PlayerValues.cs

示例10: OnPlayerConnected

	//Need to send level data to new players
	void OnPlayerConnected(NetworkPlayer player)
	{
		if(IsHost)
		{
			Debug.Log ("New player connected\n");

			//Find and get the current chunk
			GameObject Chunk = GameObject.Find ("Chunk(Clone)");
			byte[,,] map = Chunk.GetComponent<Chunk>().map;

			string ChunkData = "";
			for ( int x = 0; x < 16; x++ )
			{
				for ( int z = 0; z < 16; z++ )
				{
					ChunkData = ChunkData + map[x,0,z];
					ChunkData = ChunkData + map[x,1,z];
				}
			}

			//Send current chunk data to other players
			Debug.Log ("Sending chunk data across the network\n");
			//Sends to all clients that are connected to the server
			networkView.RPC("ChunkData", RPCMode.OthersBuffered, ChunkData);
		}
	}
开发者ID:Panamax,项目名称:UncleCraft,代码行数:27,代码来源:HostScript.cs

示例11: CreateNewPlayerOnServer

    private void CreateNewPlayerOnServer( NetworkPlayer id )
    {
        GameObject newPlayer = Network.Instantiate( playerPrefab, Vector3.zero, Quaternion.identity, 0 ) as GameObject;
        newPlayer.GetComponent<PlayerClientBehaviour>().SetPlayerID( id );

        gameControllerBahviour.Manager.AddNewPlayer( newPlayer );
    }
开发者ID:Jacko161,项目名称:Unity-Project-v2,代码行数:7,代码来源:TestNetworkBehaviour.cs

示例12: setScope

 public static void setScope(Bounds pBounds, Transform pParent,NetworkPlayer pPlayer)
 {
     foreach (Transform lTransform in pParent)
     {
         lTransform.networkView.SetScope(pPlayer,pBounds.Contains(lTransform.position));
     }
 }
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:7,代码来源:BoundNetworkScope.cs

示例13: OnPlayerConnected

	void OnPlayerConnected (NetworkPlayer player)
	{
		networkPlayers[playersConnected++] = player;
		if (playersConnected >= players) {
			InitGame();
		}
	}
开发者ID:Jrlats,项目名称:MiniMOBA,代码行数:7,代码来源:GameManager.cs

示例14: ClientAddPlayerToList

 void ClientAddPlayerToList(string playerName, NetworkPlayer view)
 {
     MPPlayer team = new MPPlayer();
     team.teamName = playerName;
     team.playerNetwork = view;
     playersList.Add(team);
 }
开发者ID:SLIPD,项目名称:PC,代码行数:7,代码来源:MultiplayerManager.cs

示例15: OnPlayerDisconnected

 void OnPlayerDisconnected( NetworkPlayer player  )
 {
     // Removing player if Network is disconnected
      Debug.Log("Server destroying player");
      Network.RemoveRPCs(player, 0);
      Network.DestroyPlayerObjects(player);
 }
开发者ID:chrisall76,项目名称:OGAM_January,代码行数:7,代码来源:Instantiate.cs


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