Exemplo n.º 1
0
        public void PlayerPickResource(RobotPlayerPart player)
        {
            if (!HasResource)
            {
                return;
            }

            var item = Factory.CreateItem();

            player.Pickup(item);

            HasResource            = false;
            NextResourceGeneration = simulationEngine.CurrentTime + GenerationInterval;
        }
Exemplo n.º 2
0
        public void PerformTrade(RobotPlayerPart player)
        {
            if (!CanTradeWith(player))
            {
                return;
            }

            var ret = player.TakeItems(WantsType, WantsAmount);

            foreach (var i in ret)
            {
                ItemFactory.Destroy(i);
            }

            for (int i = 0; i < GivesAmount; i++)
            {
                player.Pickup(ItemFactory.CreateItem(GivesType));
            }

            StoredResourcesCount -= GivesAmount;
        }
Exemplo n.º 3
0
 public bool CanTradeWith(RobotPlayerPart player)
 {
     return(player.HasItems(WantsType, WantsAmount) && player.CanPickup(GivesType, GivesAmount) && StoredResourcesCount >= GivesAmount);
 }