コード例 #1
0
    // public

    public bool HarvestResource(Actor _harvester)
    {
        if (!Proficiencies.Instance.IsHarvester(_harvester) || CurrentlyAvailable <= 0)
        {
            return(false);
        }

        if (SelectHarvestFor(_harvester).HarvestBy(_harvester))
        {
            CurrentlyAvailable -= 1;
            OnQuantityChange?.Invoke();
            return(true);
        }
        return(false);
    }
コード例 #2
0
        public void SetQuantity(int qty)
        {
            if (qty > ushort.MaxValue)
            {
                qty = ushort.MaxValue;
            }
            else if (qty < 0)
            {
                qty = 0;
            }

            quantity = qty;
            quantityInputField.SetTextWithoutNotify(qty.ToString());
            OnQuantityChange?.Invoke(this, Tuple.Create(generator, Quantity));
        }