Пример #1
0
        /// <summary>
        /// chooses with loot to drop
        /// </summary>
        private void DropItem()
        {
            //randomly chase a number to decide which item to drop
            var chance = Tools.Rnd.Next(0, 210);

            switch (chance)
            {
            case int n when n < 20:
                //drop relocate/freeze game item
                GameScene.AddItem(new RelocateItem(BasePosition));
                break;

            case int n when n < 40:
                //drop speed boost item
                GameScene.AddItem(new SpeedBoostItem(BasePosition));
                break;

            case int n when n < 100:
                //drop coin item
                GameScene.AddItem(new CoinItem(BasePosition));
                break;

            case int n when n < 130:
                //drop coin pile item
                GameScene.AddItem(new CoinPileItem(BasePosition));
                break;

            case int n when n < 170:
                //drop ammo item
                GameScene.AddItem(new Ammo(BasePosition));
                break;

            case int n when n < 210:
                //drop med kit
                GameScene.AddBullet(new MedKit(BasePosition));
                break;
            }
        }