RPC() private method

private RPC ( string name, NetworkPlayer target ) : void
name string
target NetworkPlayer
return void
Exemplo n.º 1
0
    void OnTriggerStay(Collider coll)
    {
        if (coll.tag == "Player")
        {
           // GameObject hitPlayer = coll.gameObject;

            nView = coll.GetComponent<NetworkView>();

            nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);

        }
        if (coll.tag == "Boss")
        {
            // GameObject hitPlayer = coll.gameObject;
            nView = coll.GetComponent<NetworkView>();
            nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);

            if (nView.isMine)
            {
                Sentry companion;
                companion = nView.GetComponent<Sentry>();
                companion.ClientTakeDamageFromWeapon(1);
            }
            else
            {
                nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);
            }
        }
    }
Exemplo n.º 2
0
	public static void Buffer(NetworkView view, string func, RPCMode mode, params object[] args) 
	{
		//first fix up the mode so no one accidentally passes in a buffered mode
		if(mode == RPCMode.AllBuffered)
			mode = RPCMode.All;
		else if(mode  == RPCMode.OthersBuffered)
			mode = RPCMode.Others;
			
		if(m_RPCs == null)
			m_RPCs = new BufferedRPC[0];
		BufferedRPC [] temp = new BufferedRPC[m_RPCs.Length+1];
		if(m_RPCs.Length > 0)
			m_RPCs.CopyTo(temp,0);
		
		BufferedRPC tempRPC = new BufferedRPC();
		tempRPC.func = func;
		tempRPC.mode = mode;
		if(args != null)
		{
			// for(int i = 0; i < args.Length; i++)
				// Debug.Log(args[i].ToString() + ", ");
			tempRPC.args = new object[args.Length];
			args.CopyTo(tempRPC.args,0);
		}
		tempRPC.view = view;
		temp[temp.Length-1] = tempRPC;
		m_RPCs = temp;
		
		view.RPC(func, mode, args);
	}
Exemplo n.º 3
0
 void OnTriggerEnter(Collider other)
 {
     if(other.tag == "Player")
     {
         nView = other.GetComponent<NetworkView>();
         nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 50);
     }
 }
Exemplo n.º 4
0
 public void init()
 {
     nView = GetComponent<NetworkView>();
     gameLogic = GameObject.Find("GameLogic").GetComponent<Controller>();
     gameLogic.nLogic = this;
     gameLogic.nLogicView = nView;
     if(Network.isClient)
         nView.RPC("begin", RPCMode.AllBuffered);
 }
	//fixes for network.time not being same on all teh clients.  Syncs itself to server's network.time
	void Awake ()
	{
		netView = GetComponent<NetworkView>();
		if (!Network.isServer) {
			//DebugConsole.Message("Asking server for time");
			netView.RPC ("SyncDeltaTime", RPCMode.Server);
		} else {
			time = Network.time;
		}
	}
Exemplo n.º 6
0
 void OnTriggerStay(Collider other)
 {
     if (kill)
     {
         if (other.tag == "Player")
         {
             nView = other.gameObject.GetComponent<NetworkView>();
             nView.RPC("TakeDamage", nView.owner, 1);
         }
     }
 }
Exemplo n.º 7
0
 //Sends the inputs to the server to be processed
 public void sendToServerVia(NetworkView view, InputReceiver receiver)
 {
     if(Network.peerType == NetworkPeerType.Client)
     {
         view.RPC("AddInput", RPCMode.Server, forward, straff, turnRight, turnUp, jump, fireOne, fireTwo, sprint, crouch, netPlayer.localPlayerNumber);
     }
     if (Network.peerType == NetworkPeerType.Server)
     {
         receiver.AddInput(forward, straff, turnRight, turnUp, jump, fireOne, fireTwo, sprint, crouch, netPlayer.localPlayerNumber);
     }
 }
Exemplo n.º 8
0
 void Start()
 {
     networkView = GetComponent<NetworkView>();
     if(networkView.isMine == true)
     {
         myTransform = transform;
         //Make sure everyone sees the player at right location the moment he spawns
         if(!Network.isServer)
         {
             networkView.RPC("UpdateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation);
         }
     }
 }
Exemplo n.º 9
0
    void Start()
    {
        if (GetComponent<NetworkView>().isMine)
        {
            nview = GetComponent<NetworkView>();
            nManager = GameObject.FindGameObjectWithTag("GM/NM").GetComponent<NetworkManager>();
            pColor = new Color(nManager.vColor.x, nManager.vColor.y, nManager.vColor.z);

            GetComponent<MeshRenderer>().material.color = pColor;

            nview.RPC("DeathColor", RPCMode.All, nManager.vColor);
        }
        rigidBody = GetComponent<Rigidbody>();
        randomDirection = new Vector3(Random.value, Random.value, Random.value);
        GetComponent<Rigidbody>().AddForce(randomDirection * 250);

        StartCoroutine(WaitToDespawn());
    }
Exemplo n.º 10
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        // Does the topmost game object have the "Allow stickables" script attached?
                var topMostGameObject = collision.gameObject.transform.root.gameObject;
                bool canStick = topMostGameObject.GetComponent<AllowStickables> () != null;

                // We hit something, make friction affect us now so that we dont have sliding fuckign knives everywhere
                gameObject.GetComponent<Rigidbody2D> ().drag = 10;
                gameObject.GetComponent<Rigidbody2D> ().angularDrag = 10;
                if (canStick) {
                        //gameObject.GetComponent<SetParentObject>().SetParent(
                        gameObject.rigidbody2D.isKinematic = true;
                        gameObject.collider2D.enabled = false;
                        gameObject.transform.parent = topMostGameObject.transform;

                        _enemyNV = topMostGameObject.GetComponent<NetworkView> ();
                        _enemyNV.RPC ("DisableEnemy", RPCMode.AllBuffered);
                }
    }
Exemplo n.º 11
0
    void FireWeapon()
    {
        line.enabled = true;
        Transform firePoint = transform.FindChild("FP").transform;
        Ray ray = new Ray(firePoint.position, firePoint.forward);

        if (Physics.Raycast(ray, out hit, range))
        {
            line.enabled = true;
            line.SetPosition(0, firePoint.position);
            line.SetPosition(1, hit.point + hit.normal);
            if (hit.collider.tag == "Player")
            {
                nView = hit.collider.GetComponent<NetworkView>();
                nView.RPC("RPCTakeDamage", nView.owner, 5f);
            }
            ammo--;
        }
        else
        {
            line.enabled = false;
        }
    }
Exemplo n.º 12
0
	public void updateColor(Color color)
	{
		int col = 0;

		netView = GetComponent<NetworkView>();

		if (color == Color.yellow)
			col = 0;
		if (color == Color.green)
			col = 1;
		if (color == Color.red)
			col = 2;
		if (color == Color.gray)
			col = 3;
		if (color == Color.blue)
			col = 4;


		netView.RPC("updateColorHelp", RPCMode.AllBuffered, new object[] { col });

	}
Exemplo n.º 13
0
	public void updateBool(string text, bool state)
	{
		netView = GetComponent<NetworkView>();
 		netView.RPC("updateBoolHelp", RPCMode.AllBuffered, new object[] { text, state });

	}
Exemplo n.º 14
0
    void Awake()
    {
        networkView = gameObject.GetComponent<NetworkView>();
        bullet = Resources.Load<HomingBullet>(bulletPath);
        Controller = gameObject.GetComponent<CharacterController>();

        //if(Controller == null)
            //Debug.LogWarning("OVRPlayerController: No CharacterController attached.");

        // We use OVRCameraRig to set rotations to cameras,
        // and to be influenced by rotation
        OVRCameraRig[] CameraControllers;
        CameraControllers = gameObject.GetComponentsInChildren<OVRCameraRig>();

        //if(CameraControllers.Length == 0)
            //Debug.LogWarning("OVRPlayerController: No OVRCameraRig attached.");
        //else if (CameraControllers.Length > 1)
            //Debug.LogWarning("OVRPlayerController: More then 1 OVRCameraRig attached.");
        //else
            CameraController = CameraControllers[0];

        DirXform = transform;

        //if(DirXform == null)
            //Debug.LogWarning("OVRPlayerController: ForwardDirection game object not found. Do not use.");
        networkView.RPC("Respawn", RPCMode.All, Network.player);
        #if UNITY_ANDROID && !UNITY_EDITOR
        OVRManager.display.RecenteredPose += ResetOrientation;
        #endif
    }
Exemplo n.º 15
0
    void DoStuff()
    {
        Ray ray = new Ray(transform.parent.GetComponent<Camera>().transform.position, transform.parent.GetComponent<Camera>().transform.forward);
        Vector3 pos = transform.parent.GetComponent<Camera>().transform.position;
        Vector3 dir = transform.parent.GetComponent<Camera>().transform.forward;

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            weapon = 0;
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            weapon = 1;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            weapon = 2;
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            weapon = 3;
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            weapon = 4;
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            weapon++;
            if (weapon >= 4)
            {
                weapon = 4;
            }
        }
        if (Input.GetKeyDown(KeyCode.Q))
        {
            weapon--;
            if (weapon <= 0)
            {
                weapon = 0;
            }
        }

        if (Physics.Raycast(ray, out hit, range))
        {

            #region
           /*
            if (weapon == 4)
            {

                if (Input.GetKeyDown(KeyCode.Space))
                {
                   // print("vehicle selected");
                    onVeh = !onVeh;
                    Debug.Log(onVeh);
                    if (hit.collider.tag == "Vehicle")
                    {

                        //Debug.Log("Hit Vechicle");
                        //Debug.Log(onVeh);
                        if (onVeh)
                        {
                            playCam.InVehicle();
                       //     playMovement.InVehicle();

                            mPlayer.parent = hit.collider.GetComponent<Transform>();
                            mPlayer.localPosition = new Vector3(-2.486229f, 0.32169f, 1.553621f);
                            mPlayer.transform.localRotation = Quaternion.Euler(0.2488809f, 5.57256f, 277.1208f);

                            vehicle = transform.parent.transform.parent.transform.parent.GetComponent<Vehicle>();
                            vehicle.onVehicle = !vehicle.onVehicle;

                        }

                    }
                }
            }
            else
            {
                range = 1000.0f;
            }
            * */
        #endregion

                range = 1000.0f;

                if (Input.GetMouseButtonDown(0))
                {

                    line.enabled = true;
                    line.SetPosition(0, transform.position);
                    line.SetPosition(1, hit.point + hit.normal);

                    effects.RPC("Shot", RPCMode.All, pos, dir, true);
                    laserAudio.Play();

                    AmmoChecks();

                    if (hit.collider.tag == "PlayerDeathParticle")
                    {
                        hit.rigidbody.AddForceAtPosition(2000 * dir, hit.point);
                    }

                    switch (weapon)
                    {

                        case 0:
                            {
                                // Regular Laser
                                // put if ammo > 0 or whatever
                                if (laserAmmo > 0)
                                {

                                    print("laser");

                                    if (hit.collider.tag == "Player")
                                    {
                                        nView = hit.collider.GetComponent<NetworkView>();
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                    }
                                if (hit.collider.tag == "Orb")
                                {
                                    nView = hit.collider.GetComponent<NetworkView>();
                                    nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                    if (nView.isMine)
                                    {
                                        Companion companion;
                                        companion = nView.GetComponent<Companion>();
                                        companion.ClientTakeDamageFromWeapon();
                                    }
                                    else
                                    {
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                    }
                                }

                                    //// BOSSS

                                if (hit.collider.tag == "Boss")
                                {
                                    nView = hit.collider.GetComponent<NetworkView>();
                                   // nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                    if (nView.isMine)
                                    {
                                        Sentry boss;
                                        boss = nView.GetComponent<Sentry>();
                                        boss.ClientTakeDamageFromWeapon(5);
                                    }
                                    else
                                    {
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                    }
                                }

                                if (hit.collider.tag == "SentryHealth1")
                                {
                                    nView = hit.collider.GetComponent<NetworkView>();
                                    if (nView.isMine)
                                    {
                                        SentryHealth sentryHealth;
                                        sentryHealth = nView.GetComponent<SentryHealth>();
                                        sentryHealth.ClientTakeDamageFromWeapon(5);

                                    }
                                    else
                                    {
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                    }

                                }
                                if (hit.collider.tag == "SentryHealth2")
                                {
                                    nView = hit.collider.GetComponent<NetworkView>();
                                    if (nView.isMine)
                                    {
                                        SentryHealth sentryHealth;
                                        sentryHealth = nView.GetComponent<SentryHealth>();
                                        sentryHealth.ClientTakeDamageFromWeapon(5);
                                    }

                                }

                                if (laserAmmo == 0)
                                    {
                                        StartCoroutine(LaserAmmoSpawn());
                                    }

                                    Vector3 explosionPos = new Vector3(hit.point.x, hit.point.y, hit.point.z);
                                    effects.RPC("LaserHit", RPCMode.All, explosionPos);

                                    laserAmmo--;
                                }

                                break;
                            }
                        case 1:
                            {
                                // Incendairy Laser
                                if (incendaryAmmo > 0)
                                {
                                    print("Incendairy");
                                    if (hit.collider.tag == "Player")
                                    {
                                        nView = hit.collider.GetComponent<NetworkView>();
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 10);
                                    }
                                    if (hit.collider.tag == "Orb")
                                    {
                                        nView = hit.collider.GetComponent<NetworkView>();
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                        if (nView.isMine)
                                        {
                                            Companion companion;
                                            companion = nView.GetComponent<Companion>();
                                            companion.ClientTakeDamageFromWeapon();
                                        }
                                        else
                                        {
                                            nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 5);
                                        }
                                    }

                                    if (hit.collider.tag == "Boss")
                                     {
                                    nView = hit.collider.GetComponent<NetworkView>();
                                    nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 10);
                                    if (nView.isMine)
                                    {
                                        Sentry boss;
                                        boss = nView.GetComponent<Sentry>();
                                        boss.ClientTakeDamageFromWeapon(10);
                                    }
                                    else
                                    {
                                        nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 10);
                                    }
                                }
                                    incendaryAmmo--;
                                    Vector3 explosionPos = new Vector3(hit.point.x, hit.point.y, hit.point.z);
                                    effects.RPC("Explosion", RPCMode.All, explosionPos);
                                }
                                else
                                {
                                    weapon = 0;
                                }

                                break;
                            }
                        case 2:
                            {
                                // Flash Laser
                                if (flashAmmo > 0)
                                {

                                    print("flash");
                                    flashAmmo--;
                                    Vector3 explosionPos = new Vector3(hit.point.x, hit.point.y, hit.point.z);
                                    effects.RPC("FlashExplosion", RPCMode.All, explosionPos);

                                }
                                else
                                {
                                    weapon = 0;
                                }
                                break;
                            }
                        case 3:
                            {
                                // Stasis Laser
                                if (stasisAmmo > 0)
                                {
                                    if (hit.collider.tag == "Player")
                                    {
                                        print("stasis");

                                        nView = hit.collider.GetComponent<NetworkView>();
                                        nView.RPC("Stasis", nView.owner);
                                    }
                                    stasisAmmo--;
                                }
                                else
                                {
                                    weapon = 0;
                                }
                                break;
                            }
                        case 4:
                            {
                                // Levi

                                if (leviAmmo > 0)
                                {
                                    if (hit.collider.tag == "Player")
                                    {
                                        nView = hit.collider.GetComponent<NetworkView>();
                                        nView.RPC("Levitation", nView.owner, 5);

                                    }
                                    leviAmmo--;
                                }
                                else
                                {
                                    weapon = 0;
                                }
                                break;
                            }
                        case 5:
                            {
                                // new ammo goes here, sniffer
                                if (seekerAmmo > 0)
                                {

                                    if (hit.collider.tag == "Player")
                                    {
                                        nView = hit.collider.GetComponent<NetworkView>();
                                        nView.RPC("Seek", nView.owner);
                                    }
                                    seekerAmmo--;
                                }
                                else
                                {
                                    weapon = 0;
                                }

                                break;
                            }
                        case 6:
                            {
                                if (NukeAmmo > 0)
                                {
                                    Vector3 explosionPos = new Vector3(hit.point.x, hit.point.y, hit.point.z);
                                    effects.RPC("NukeHit", RPCMode.All, explosionPos);
                                }
                                else
                                {
                                    weapon = 0;
                                }

                                break;
                            }

                    }
                }
                else
                {
                    effects.RPC("Shot", RPCMode.All, pos, dir, false);
                    line.enabled = false;
                }

        }
    }
Exemplo n.º 16
0
    void OnConnectedToServer()
    {
        if (!onConnectionDataSent){
            string playerID = Network.player.ToString();

            var p = new PlayerInformation();
            p.playerName = playerName;

            playerInformation[playerID] = p;
            netView = GetComponent("NetworkView") as NetworkView;
            netView.RPC ("ReceivePlayerData", RPCMode.AllBuffered, Network.player.ToString(), p.ToString ());
            onConnectionDataSent = true;
            connectionState = ConnectionState.InLobby;
        }
    }
    // Use this for initialization
    void Start()
    {
        GameSettingSingleton.Instance.BreakableBlockList.Clear();
        _cam = GameObject.Find("Main Camera").camera;
        _myNetView = this.GetComponent<NetworkView>();

        //Generate Arena
        if(Network.isServer)
        {
            ResetRespawnPosition();
            _myNetView.RPC("RPC_DestroyArena", RPCMode.All);
            _myNetView.RPC("RPC_GenerateArena", RPCMode.All,GameSettingSingleton.Instance.CurrentLoadedArena);

            foreach(var blockPos in GameSettingSingleton.Instance.BreakableBlockList)
            {
                _myNetView.RPC("GenerateBreakableBlock",RPCMode.All,blockPos.Value,blockPos.Key);

            }
        }
    }
Exemplo n.º 18
0
    void MainAI()
    {
        direction = ((players[playerChoice].transform.position - new Vector3(0,0,0))- transform.position).normalized;
        lookRotation = Quaternion.LookRotation(direction);
        transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, (5f * Time.deltaTime));

        if (fire)
        {
            Ray ray = new Ray(transform.position, transform.forward);
            Vector3 pos = transform.position;
            Vector3 dir = transform.forward;
            if (Physics.Raycast(ray, out hit, range))
            {
                if (weapon == 0)
                {
                    line.enabled = true;
                    line.SetPosition(0, transform.position);
                    line.SetPosition(1, hit.point + hit.normal);
                    nView.RPC("Shot", RPCMode.All, pos, dir, fire);
                    nView.RPC("LaserHit", RPCMode.All, new Vector3(hit.point.x, hit.point.y, hit.point.z));
                }
                else
                {
                    line.enabled = false;
                }
                if (hit.collider.tag == "Player")
                {

                    switch (weapon)
                    {
                        case 0:
                            {
                                line.enabled = true;
                                line.SetPosition(0, transform.position);
                                line.SetPosition(1, hit.point + hit.normal);
                                nView.RPC("Shot", RPCMode.All, pos, dir, fire);
                                nView.RPC("LaserHit", RPCMode.All, new Vector3(hit.point.x, hit.point.y, hit.point.z));

                                pView = hit.collider.GetComponent<NetworkView>();

                                if (pView.isMine)
                                {
                                    PlayerMovement pMovement;
                                    pMovement = hit.collider.GetComponent<PlayerMovement>();
                                    pMovement.ClientTakeDamageFromWeapon(1);
                                }
                                else
                                {
                                    pView.RPC("NetworkTakeDamageFromWeapon", pView.owner, 1);
                                }

                                break;
                            }

                        case 1:
                            {
                                if (ammoCount > 0)
                                {
                                    Network.Instantiate(orb, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity, 0);
                                    ammoCount--;
                                }
                                break;
                            }
                    }

                }

                #region lower level health
                /*
                if (health < 500)
                {
                    List<GameObject> currentPlayers = new List<GameObject>();
                    foreach (GameObject gO in players)
                    {
                        currentPlayers.Add(gO);
                    }

                    for (int i = 0; i < currentPlayers.Count; i++)
                    {

                    }
                }
                 * */
                #endregion

            }
            else
            {
                line.enabled = false;
            }
        }
        else
        {
            line.enabled = false;
        }
    }
Exemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     mat = GetComponent<Material>();
     nView = GetComponent<NetworkView>();
     nManager = GameObject.FindGameObjectWithTag("GM/NM").GetComponent<NetworkManager>();
     if (nView.isMine)
     {
         if (nManager.playeName == "Danker")
         {
             nView.RPC("ShowDev", RPCMode.All, true);
         }
         else
         {
             nView.RPC("ShowDev", RPCMode.All, false);
         }
     }
 }
Exemplo n.º 20
0
    void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Player")
        {
            pView = other.GetComponent<NetworkView>();

           // pView.RPC("NetworkTakeDamageFromWeapon", pView.owner, 5);
            if (pView.isMine)
            {
                PlayerMovement pMovement;
                pMovement = other.GetComponent<PlayerMovement>();
                pMovement.ClientTakeDamageFromWeapon(5);
            }
            else
            {
                pView.RPC("NetworkTakeDamageFromWeapon", pView.owner, 5);
            }
            Network.Instantiate(explosion, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity, 0);
            Network.Destroy(this.gameObject);
        }
    }
    void Start()
    {
        player = GetComponent<GameObject>();

        nView = GetComponent<NetworkView>();
        sprite = this.GetComponent<MeshRenderer>();

        id = nView.viewID;
        nManager = GameObject.FindGameObjectWithTag("GM/NM").GetComponent<NetworkManager>();

        vColor = nManager.vColor;
        username = nManager.playeName;
        nView.RPC("PlayerColor", RPCMode.All, vColor, username);
    }
Exemplo n.º 22
0
    void Start()
    {
        network = GetComponent<NetworkView>();

        Debug.Log("i'am " + Network.player);

        mainMenuButton = GameObject.Find("mainMenuButton");
        handCardGrid = GameObject.Find("handCardGrid");
        outCardGrid = GameObject.Find("outCardGrid");

        mainMenuButton.SetActive(false);

        if (CardData.instance)
        {
            if (CardData.instance.cardJsonData != null)
            {
                cardNames.Clear();
                Debug.Log("load cards");
                LitJson.JsonData pa = CardData.instance.cardJsonData;

                for (int i = 0; i < pa.Count; i++)//pa 意思是card 种类
                {
                    Card card = new Card();
                    foreach (string item in ((IDictionary)(pa[i])).Keys)//key意思是 card的每个属性
                    {
                        LitJson.JsonData data = pa[i];
                        if (item == "name")
                        {
                            card.name = data[item].ToString();
                        }
                        else if (item == "weight")
                        {
                            card.weight = data[item].ToString();
                        }
                        else if (item == "style")
                        {
                            card.style = data[item].ToString();
                        }
                    }
                    cardNames.Add(card);
                }
                network.RPC("InitCards", RPCMode.AllBuffered, LitJson.JsonMapper.ToJson(cardNames));
            }
        }

        if (Network.isServer)
        {
            mainMenuButton.SetActive(true);

            Random.seed = System.Environment.TickCount;
            pileCards.Clear();
            for (int i = 0; i < cardNames.Count; i++)
            {
                pileCards.Add(i);
            }
            for (int i = 0; i < cardConfig.startCardCount; i++)
            {

                for (int j = 0; j < Network.connections.Length + 1; j++)
                {
                    if (pileCards.Count > 0)
                    {
                        int index = Random.Range(0, pileCards.Count);
                        if (j == Network.connections.Length)
                        {
                            ActionSendCard(Network.player, pileCards[index]);
                            pileCards.RemoveAt(index);
                        }
                        else
                        {
                            network.RPC("ActionSendCard", RPCMode.Others, Network.connections[j], pileCards[index]);
                            pileCards.RemoveAt(index);
                        }
                    }
                }
            }

        }
    }