Пример #1
0
        protected override void Trader_Update(object sender, TraderEventArgs e)
        {
            var food = e.TraderProxy.Store[DoranAndParberryExample.Food].Amount;
            var tools = e.TraderProxy.Store[DoranAndParberryExample.Tools].Amount;
            var ore = e.TraderProxy.Store[DoranAndParberryExample.Ore].Amount;

            if (food >= 1 && ore >= 1)
            {
                if (tools >= 1)
                {
                    Consume(e.TraderProxy, DoranAndParberryExample.Tools, 1, 0.1f);
                }
                else
                {
                    if (ore > 2) ore = 2;
                }
                Produce(e.TraderProxy, DoranAndParberryExample.Metal, ore);
                Consume(e.TraderProxy, DoranAndParberryExample.Ore, ore);
                Consume(e.TraderProxy, DoranAndParberryExample.Food, 1);
            }
            else
            {
                e.TraderProxy.AddMoney(-2f);
            }
        }
Пример #2
0
        protected override void Trader_Update(object sender, TraderEventArgs e)
        {
            var workforce = e.TraderProxy.Store[CityExample.Workforce].Amount;
            var wood = e.TraderProxy.Store[CityExample.Wood].Amount;
            var tools = e.TraderProxy.Store[CityExample.Tools].Amount;

            if (wood >= 1 && workforce >= 1)
            {
                Consume(e.TraderProxy, CityExample.Wood, 1);
                Consume(e.TraderProxy, CityExample.Workforce, 1);
                if (tools >= 1)
                {
                    Produce(e.TraderProxy, CityExample.Food, 4);
                    Consume(e.TraderProxy, CityExample.Tools, 1, 0.1f);
                }
                else
                {
                    Produce(e.TraderProxy, CityExample.Food, 2);
                }
            }
            else
            {
                e.TraderProxy.AddMoney(-2f);
            }
        }
Пример #3
0
        protected override void Trader_Update(object sender, TraderEventArgs e)
        {
            var workforce = e.TraderProxy.Store[CityExample.Workforce].Amount;
            var tools = e.TraderProxy.Store[CityExample.Tools].Amount;
            var ore = e.TraderProxy.Store[CityExample.Ore].Amount;

            if (workforce >= 1 && ore >= 1)
            {
                if (tools >= 1)
                {
                    Consume(e.TraderProxy, CityExample.Tools, 1, 0.1f);
                }
                else
                {
                    if (ore > 2) ore = 2;
                }
                Produce(e.TraderProxy, CityExample.Metal, ore);
                Consume(e.TraderProxy, CityExample.Ore, ore);
                Consume(e.TraderProxy, CityExample.Workforce, 1);
            }
            else
            {
                e.TraderProxy.AddMoney(-2f);
            }
        }
Пример #4
0
 private void Trader_Init(object sender, TraderEventArgs e)
 {
     foreach (var item in StartingAmount)
     {
         e.TraderProxy.AddGoods(item.Good, item.Amount);
     }
     e.TraderProxy.AddMoney(StartingMoney);
 }
Пример #5
0
        protected override void Trader_Update(object sender, TraderEventArgs e)
        {
            var workforce = e.TraderProxy.Store[CityExample.Workforce].Amount;
            var metal = e.TraderProxy.Store[CityExample.Metal].Amount;

            if (workforce >= 1 && metal >= 1)
            {
                Produce(e.TraderProxy, CityExample.Tools, metal);
                Consume(e.TraderProxy, CityExample.Workforce, 1);
                Consume(e.TraderProxy, CityExample.Metal, metal);
            }
            else
            {
                e.TraderProxy.AddMoney(-2f);
            }
        }
Пример #6
0
        protected override void Trader_Update(object sender, TraderEventArgs e)
        {
            var food = e.TraderProxy.Store[DoranAndParberryExample.Food].Amount;
            var metal = e.TraderProxy.Store[DoranAndParberryExample.Metal].Amount;

            if (food >= 1 && metal >= 1)
            {
                Produce(e.TraderProxy, DoranAndParberryExample.Tools, metal);
                Consume(e.TraderProxy, DoranAndParberryExample.Food, 1);
                Consume(e.TraderProxy, DoranAndParberryExample.Metal, metal);
            }
            else
            {
                e.TraderProxy.AddMoney(-2f);
            }
        }
Пример #7
0
        protected override void Trader_Update(object sender, TraderEventArgs e)
        {
            var food = e.TraderProxy.Store[DoranAndParberryExample.Food].Amount;
            var tools = e.TraderProxy.Store[DoranAndParberryExample.Tools].Amount;

            if (food >= 1)
            {
                if (tools >= 1)
                {
                    Produce(e.TraderProxy, DoranAndParberryExample.Wood, 2);
                    Consume(e.TraderProxy, DoranAndParberryExample.Food, 1);
                    Consume(e.TraderProxy, DoranAndParberryExample.Tools, 1, 0.1f);
                }
                else
                {
                    Produce(e.TraderProxy, DoranAndParberryExample.Wood, 1);
                    Consume(e.TraderProxy, DoranAndParberryExample.Food, 1);
                }
            }
            else
            {
                e.TraderProxy.AddMoney(-2f);
            }
        }
Пример #8
0
 private void Trader_Init(object sender, TraderEventArgs e)
 {
     e.TraderProxy.AddGoods(CityExample.Tools, 1);
     e.TraderProxy.AddGoods(CityExample.Workforce, 1);
     e.TraderProxy.AddMoney(100);
 }
Пример #9
0
 protected abstract void Trader_Update(object sender, TraderEventArgs e);