TakeCash() public method

public TakeCash ( int num, bool notifyLowFunds = false ) : bool
num int
notifyLowFunds bool
return bool
示例#1
0
        public void Tick(PlayerResources pr)
        {
            if (Done)
            {
                if (OnComplete != null) OnComplete();
                return;
            }

            if (Paused) return;

            if (pm.PowerState != PowerState.Normal)
            {
                if (--slowdown <= 0)
                    slowdown = Queue.Info.LowPowerSlowdown;
                else
                    return;
            }

            var costThisFrame = RemainingCost / RemainingTime;
            if (costThisFrame != 0 && !pr.TakeCash(costThisFrame)) return;
            RemainingCost -= costThisFrame;
            RemainingTime -= 1;
            if (RemainingTime > 0) return;

            Done = true;
        }
示例#2
0
        public void Tick(PlayerResources pr)
        {
            if (!Started)
            {
                var time = Queue.GetBuildTime(Item);
                if (time > 0)
                    RemainingTime = TotalTime = time;

                Started = true;
            }

            if (Done)
            {
                if (OnComplete != null)
                    OnComplete();

                return;
            }

            if (Paused)
                return;

            if (pm.PowerState != PowerState.Normal)
            {
                if (--Slowdown <= 0)
                    Slowdown = Queue.Info.LowPowerSlowdown;
                else
                    return;
            }

            var costThisFrame = RemainingCost / RemainingTime;
            if (costThisFrame != 0 && !pr.TakeCash(costThisFrame, true))
                return;

            RemainingCost -= costThisFrame;
            RemainingTime -= 1;
            if (RemainingTime > 0)
                return;

            Done = true;
        }