Example #1
0
    public void PlayerPickedItem(byte[] packet)
    {
        int itemType = BitConverter.ToInt32(packet, 8);

        if (itemType == (int)Types.ItemTypes.Weapon)
        {
            int Weapontype = BitConverter.ToInt32(packet, 12);
            MethodQueue.Enqueue(() => {
                GameObject inst = Instantiate(PrefabHandler.GetWeapon((Types.WeaponTypes)Weapontype).gameObject, Vector3.zero, Quaternion.identity);
                netPlayerScript.EquipWeapon(inst.GetComponent <Item>() as Weapon);
            });
        }
    }