예제 #1
0
 protected void ClearQueue()
 {
     // Refund the current item
     foreach (var item in Queue)
     {
         playerResources.GiveCash(item.TotalCost - item.RemainingCost);
     }
     Queue.Clear();
 }
예제 #2
0
        protected void ClearQueue()
        {
            if (queue.Count == 0)
            {
                return;
            }

            // Refund the current item
            playerResources.GiveCash(queue[0].TotalCost - queue[0].RemainingCost);
            queue.Clear();
        }
예제 #3
0
        public void GiveResource(int amount)
        {
            if (info.UseStorage)
            {
                if (info.DiscardExcessResources)
                {
                    amount = Math.Min(amount, playerResources.ResourceCapacity - playerResources.Resources);
                }
                playerResources.GiveResources(amount);
            }
            else
            {
                playerResources.GiveCash(amount);
            }

            var purifiers = self.World.ActorsWithTrait <IResourcePurifier>().Where(x => x.Actor.Owner == self.Owner).Select(x => x.Trait);

            foreach (var p in purifiers)
            {
                p.RefineAmount(amount);
            }

            if (info.ShowTicks)
            {
                currentDisplayValue += amount;
            }
        }
예제 #4
0
        public void GiveResource(int amount)
        {
            if (info.UseStorage)
            {
                if (info.DiscardExcessResources)
                {
                    amount = Math.Min(amount, playerResources.ResourceCapacity - playerResources.Resources);
                }

                playerResources.GiveResources(amount);
            }
            else
            {
                playerResources.GiveCash(amount);
            }

            if (info.ShowTicks)
            {
                currentDisplayValue += amount;
            }
        }
예제 #5
0
        void ModifyCash(Actor self, Player newOwner, int amount)
        {
            if (amount < 0)
            {
                // Check whether the amount of cash to be removed would exceed available player cash, in that case only remove all the player cash
                var drain = Math.Min(resources.Cash + resources.Resources, -amount);
                resources.TakeCash(drain);

                if (info.ShowTicks)
                {
                    AddCashTick(self, -drain);
                }
            }
            else
            {
                resources.GiveCash(amount);
                if (info.ShowTicks)
                {
                    AddCashTick(self, amount);
                }
            }
        }