コード例 #1
0
        public void SellPotion(Potion potion, Shopkeeper shopkeeper)
        {
            this.Gold += potion.Value;

            this.PotionsForSale.Remove(potion);

            this.OnPotionSold(potion, shopkeeper);
        }
コード例 #2
0
ファイル: World.cs プロジェクト: daviskauffmann/Alchemy
        public void Start()
        {
            this.Shop.Start();

            DayChanged += (sender, e) => {
                Employee applicant = null;

                var name   = this.NameDatabase[this.Random.Next(this.NameDatabase.Length)];
                var salary = this.Random.Next(1, 100);

                switch (this.Random.Next(4))
                {
                case 0: applicant = new Herbalist(name, salary); break;

                case 1: applicant = new Guard(name, salary); break;

                case 2: applicant = new Apothecary(name, salary); break;

                case 3: applicant = new Shopkeeper(name, salary); break;
                }

                if (applicant != null)
                {
                    this.ReceiveApplication(applicant);
                }
            };

            DayChanged += (sender, e) => {
                var flask = (Flask)this.FlaskDatabase[this.Random.Next(this.FlaskDatabase.Length)].Clone();

                this.DisplayFlask(flask);
            };

            DayChanged += (sender, e) => {
                this.Shop.Gold += 1000;
            };
        }
コード例 #3
0
 private void OnPotionSold(Potion potion, Shopkeeper shopkeeper) => PotionSold?.Invoke(this, new PotionSoldEventArgs(potion, shopkeeper));