Exemplo n.º 1
0
    public void SetAttached(PlacableData placable)
    {
        RemoveAttached();

        CurrentAttached      = Instantiate(placable.Prefab).GetComponent <Placable>();
        CurrentAttached.Data = placable;
        ItemController itemController = CurrentAttached.GetComponent <ItemController>();

        if (itemController != null)
        {
            if (placable.Unlimited)
            {
                itemController.SetAmountLeft(1f);
            }
            else
            {
                itemController.SetAmountLeft(PlayerManager.Instance.GetItemHealth(placable) - (PlayerManager.Instance.GetInventoryCount(placable) - 1));
            }
        }
        CurrentAttached.transform.SetParent(provider.holdAttachPoint);
        CurrentAttached.transform.localPosition = Vector3.zero;
        CurrentAttached.transform.localRotation = placable.Prefab.transform.rotation;
        CurrentAttached.transform.localScale    = Vector3.one;

        playArea.CheckForCats();
    }