Exemplo n.º 1
0
    public IPromise Pick(Item item, bool animate = true) {
        Init();
        if (pickStun.OnCooldown()) {
            Debug.Log("Pick on cooldown");
            return Promise.Resolved();
        }
        items.Add(item);
        selected = item;

        item.Picked(unit);

        if (DebugManager.debug) {
            Debug.Log(string.Format("Pick {0}", item));
        }
        GameObject slotObject = slotPool.Take();
        InventorySlot slot = slotObject.GetComponent<InventorySlot>();
        slot.Init(this, item);

        onChanged();
        if (animate == false) {
            SkipAnimation();
        }

        return slot.Ready();
    }