static void PickUpWeapon(Player_Item_Sr item, Player_MovePlayer controll) { Player_Weapon_Sr weap = null; weap = item.gameObject.GetComponent <Player_Weapon_Sr>(); if (weap) { weap.TakeWeapon(controll.weapon, controll.index); } }
//Add new player on map static void PlayerLoad(NetworkConnection con, Data_PlayerFile_Sr data, int roomID) { Room room = GetRoom(roomID); if (room) { GameObject go = (GameObject)Instantiate((GameObject)Resources.Load("Player"), room.spawnPosition, Quaternion.identity); go.name = data.nick; Player_MovePlayer move = go.GetComponent <Player_MovePlayer>(); move.playerCon = con; PlayerConnectToRoom(roomID, data, go); Message_Sr.NewPlayerOnScene_Sr newPL = new Message_Sr.NewPlayerOnScene_Sr(); newPL.player = GetPlayerData(data.sessionID); SendReliableToRoom(Networking_msgType_Sr.NewPlayerConnnectOnScene, newPL, roomID); Player_Weapon_Sr weap = InstantiateWeapon(weaponType_Sr.GaussGun, roomID); if (weap) { weap.TakeWeapon(move.weapon, data.sessionID); } } }