示例#1
0
    public static void HandlePickUpItem(NetworkMessage netMsg)
    {
        Message_Sr.PickUpWeapon_Sr pick = netMsg.ReadMessage <Message_Sr.PickUpWeapon_Sr>();

        if (Networking_OnConnect.AccountVerefication(pick.index, pick.log, pick.pass))
        {
            Player_MovePlayer controll = GetPlayerController(pick.index);
            if (controll)
            {
                controll.DropWeapon();
                PickUpItem(pick.indexItem, controll);
            }
        }
    }
示例#2
0
    /// <summary>
    /// Player take this weapon
    /// </summary>
    /// <param name="obj">hand</param>
    /// <param name="sessionID">player index</param>
    public virtual void TakeWeapon(Transform obj, int sessionID)
    {
        updatePos = false;
        dropped   = false;
        SetPhysics(false);
        transform.SetParent(obj, false);
        transform.localPosition    = Vector3.zero;
        transform.localEulerAngles = euler;
        shooterIndex = sessionID;
        Player_MovePlayer controll = RoomsManager.GetPlayerController(sessionID);

        controll.weaponOnMe = this;
        //Send action to all player
        Message_Sr.PickUpWeapon_Sr up = new Message_Sr.PickUpWeapon_Sr();
        up.index      = controll.index;
        up.indexItem  = index;
        up.thisPlayer = false;
        RoomsManager.SendToAllOtherPlayer(Networking_msgType_Sr.PickUp, up, controll.index);
        up.thisPlayer = true;
        up.ammo       = ammo;
        up.ammoMax    = maxAmmo;
        RoomsManager.SendToThisPlayer(Networking_msgType_Sr.PickUp, up, controll.index);
    }