예제 #1
0
 public Addiction(Addiction addiction)
 {
     _addictionType       = addiction._addictionType;
     _addictionChance     = addiction._addictionChance;
     _withdrawDelay       = addiction._withdrawDelay;
     _withdrawDelayLength = addiction._withdrawDelayLength;
     _addictWithdraw      = addiction._addictWithdraw;
     _withdrawLength      = addiction._withdrawLength;
     _effects             = addiction._effects;
 }
예제 #2
0
    public bool TryPassTime(int amount, Effect.DelayLength length, out WithdrawInfo withdrawInfo)
    {
        withdrawInfo = new WithdrawInfo
        {
            nowInWithdraw = _withdrawStarted,
            wasInWithdraw = _withdrawStarted
        };

        if (!_withdrawStarted)
        {
            if (_withdrawDelayLength != length)
            {
                return(false);
            }

            _withdrawDelay -= amount;
            if (_withdrawDelay <= 0)
            {
                _withdrawStarted           = true;
                withdrawInfo.nowInWithdraw = true;
            }
        }
        else
        {
            if (_withdrawLength != length)
            {
                return(false);
            }

            _addictWithdraw -= amount;
            if (_addictWithdraw <= 0)
            {
                withdrawInfo.withdrawEnding = true;
            }
        }

        return(true);
    }