Ejemplo n.º 1
0
        /// <summary>
        /// Привязывает 3д модель к персонажу.
        /// </summary>
        private void AttachToEquipment(Inventory inventory, Item item)
        {
            if (item.item3DModel == null)
            {
                Debug.LogError("ERROR 404 - item " + item.itemName + " doesn't have item3DModel");
                return;
            }


            if (inventory == rHandEquipment)
            {
                if (!(item is TwoHandedItem))
                {
                    Item3DModel Rweapon = Instantiate(item.item3DModel, placeRHand.position, placeRHand.rotation).GetComponent <Item3DModel>();
                    Rweapon.transform.parent          = placeRHand;
                    Rweapon.itemRigidbody.isKinematic = true;
                }
            }
            if (inventory == lHandEquipment)
            {
                Item3DModel Lweapon = Instantiate(item.item3DModel, placeLHand.position, placeLHand.rotation).GetComponent <Item3DModel>();
                Lweapon.transform.parent          = placeLHand;
                Lweapon.itemRigidbody.isKinematic = true;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Выброс предмета в физ мир.
        /// </summary>
        private void ThrowItem(Item item, Inventory inventory)
        {
            if (!ThrowPoint._instance)
            {
                return;
            }
            if (item.item3DModel == null)
            {
                Debug.LogError(item.itemName + " not have item3DModel");
                return;
            }
            Item3DModel throwingItem = Instantiate(item.item3DModel).GetComponent <Item3DModel>();

            throwingItem.transform.position        = ThrowPoint._instance.transform.position;
            throwingItem.itemRigidbody.isKinematic = false;
        }