public float PurchaseUpkeepTime(DecayEntity entity, float deltaTime)
    {
        float             single  = this.CalculateUpkeepPeriodMinutes() * 60f;
        float             single1 = this.CalculateUpkeepCostFraction() * deltaTime / single;
        List <ItemAmount> list    = Facepunch.Pool.GetList <ItemAmount>();

        entity.CalculateUpkeepCostAmounts(list, single1);
        bool flag = this.CanAffordUpkeepPayment(list);

        this.QueueUpkeepPayment(list);
        Facepunch.Pool.FreeList <ItemAmount>(ref list);
        this.ApplyUpkeepPayment();
        if (!flag)
        {
            return(0f);
        }
        return(deltaTime);
    }
Esempio n. 2
0
    public float PurchaseUpkeepTime(DecayEntity entity, float deltaTime)
    {
        float             num        = CalculateUpkeepCostFraction();
        float             num2       = CalculateUpkeepPeriodMinutes() * 60f;
        float             multiplier = num * deltaTime / num2;
        List <ItemAmount> obj        = Facepunch.Pool.GetList <ItemAmount>();

        entity.CalculateUpkeepCostAmounts(obj, multiplier);
        bool num3 = CanAffordUpkeepPayment(obj);

        QueueUpkeepPayment(obj);
        Facepunch.Pool.FreeList(ref obj);
        ApplyUpkeepPayment();
        if (!num3)
        {
            return(0f);
        }
        return(deltaTime);
    }
    public float PurchaseUpkeepTime(DecayEntity entity, float deltaTime)
    {
        double            upkeepCostFraction = (double)this.CalculateUpkeepCostFraction();
        float             num1       = this.CalculateUpkeepPeriodMinutes() * 60f;
        double            num2       = (double)deltaTime;
        float             multiplier = (float)(upkeepCostFraction * num2) / num1;
        List <ItemAmount> list       = (List <ItemAmount>)Pool.GetList <ItemAmount>();

        entity.CalculateUpkeepCostAmounts(list, multiplier);
        int num3 = this.CanAffordUpkeepPayment(list) ? 1 : 0;

        this.QueueUpkeepPayment(list);
        // ISSUE: cast to a reference type
        Pool.FreeList <ItemAmount>((List <M0>&) ref list);
        this.ApplyUpkeepPayment();
        if (num3 == 0)
        {
            return(0.0f);
        }
        return(deltaTime);
    }