Пример #1
0
    public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
    {
        Item item       = (Item)interactionEvent.Source;
        Item targetItem = interactionEvent.Target.GetComponent <Item>();

        if (Consume)
        {
            ItemHelpers.DestroyItem(item);
        }

        GameObject targetGameObject = targetItem.gameObject;


        for (int index = 0; index < ResultingObjects.Length; index++)
        {
            CraftingResult result     = ResultingObjects[index];
            Item           created    = ItemHelpers.CreateItem(result.Prefab);
            GameObject     gameObject = created.gameObject;
            gameObject.transform.position    = targetGameObject.transform.position + targetGameObject.transform.rotation * result.Position;
            gameObject.transform.eulerAngles = targetGameObject.transform.eulerAngles + result.Rotation;

            if (index == 0 && ResultingObjects.Length == 1)
            {
                ItemHelpers.ReplaceItem(targetItem, created);
            }
        }

        if (ResultingObjects.Length > 1)
        {
            ItemHelpers.DestroyItem(targetItem);
        }


        return(false);
    }
        /// <inheritdoc />
        public void ShowResult(CraftingResult result, Item?createdItem)
        {
            var itemData = new byte[this.player.ItemSerializer.NeededSpace];

            if (createdItem is { })