예제 #1
0
        private void InitContents(FruitType type)
        {
            Food item  = null;
            byte count = (byte)Utility.RandomMinMax(10, 30);

            for (byte i = 0; i < count; i++)
            {
                switch (type)
                {
                default:
                case FruitType.Apples: item = new Apple(); break;

                case FruitType.Bananas: item = new Banana(); break;

                case FruitType.Bread: item = new BreadLoaf(); break;

                case FruitType.Gourds: item = new Gourd(); break;

                case FruitType.Grapes: item = new Grapes(); break;

                case FruitType.Lemons: item = new Lemon(); break;

                case FruitType.Tomatoes: item = new Tomato(); break;

                case FruitType.Vegetables1:
                case FruitType.Vegetables2:
                case FruitType.Vegetables3:
                {
                    switch (Utility.Random(4))
                    {
                    case 0: item = new Carrot(); break;

                    case 1: item = new Onion(); break;

                    case 2: item = new Pumpkin(); break;

                    case 3: item = new Gourd(); break;
                    }
                    break;
                }
                }

                if (item != null)
                {
                    DropItem(item);
                }
            }
        }
예제 #2
0
		private void InitContents( FruitType type )
		{
			Food item = null;
			byte count = (byte)Utility.RandomMinMax( 10, 30 );

			for( byte i = 0; i < count; i++ )
			{
				switch( type )
				{
					default:
					case FruitType.Apples: item = new Apple(); break;
					case FruitType.Bananas: item = new Banana(); break;
					case FruitType.Bread: item = new BreadLoaf(); break;
					case FruitType.Gourds: item = new Gourd(); break;
					case FruitType.Grapes: item = new Grapes(); break;
					case FruitType.Lemons: item = new Lemon(); break;
					case FruitType.Tomatoes: item = new Tomato(); break;
					case FruitType.Vegetables1:
					case FruitType.Vegetables2:
					case FruitType.Vegetables3:
						{
							switch( Utility.Random( 4 ) )
							{
								case 0: item = new Carrot(); break;
								case 1: item = new Onion(); break;
								case 2: item = new Pumpkin(); break;
								case 3: item = new Gourd(); break;
							}
							break;
						}
				}

				if( item != null )
					DropItem( item );
			}
		}