Пример #1
0
        public virtual void SpawnTrees(Field Handeling)
        {
            if (Handeling.AllowTrees == false)
            {
                return;
            }

            int  numberOfTrees = Handeling.NumberOfTrees;
            int  kindOfTree    = 0;
            Item tree          = null;

            int randomValueX = 0;
            int randomValueY = 0;
            int negative     = 0;

            for (int i = 0; i < numberOfTrees; i++)
            {
                kindOfTree = Utility.Random(4);

                randomValueX = Utility.Random(20);
                negative     = Utility.Random(2);
                if (negative > 0)
                {
                    randomValueX *= -1;
                }

                negative     = Utility.Random(2);
                randomValueY = Utility.Random(20);
                if (negative > 0)
                {
                    randomValueY *= -1;
                }

                switch (kindOfTree)
                {
                case 0:
                {
                    tree = new FieldTree1();
                    break;
                }

                case 1:
                {
                    tree = new FieldTree2();
                    break;
                }

                case 2:
                {
                    tree = new FieldTree3();
                    break;
                }

                case 3:
                {
                    tree = new FieldTree4();
                    break;
                }
                }

                tree.Location = new Point3D((spawnpoint.X + randomValueX), (spawnpoint.Y + randomValueY), (spawnpoint.Z));
                tree.Map      = spawnmap;
                Trees.Add(tree);
            }
        }
Пример #2
0
		public virtual void SpawnTrees( Field Handeling )
		{
			if ( Handeling.AllowTrees == false )
				return;
		
			int numberOfTrees = Handeling.NumberOfTrees;
			int kindOfTree = 0;
			Item tree = null;
			
			int randomValueX = 0;
			int randomValueY = 0;
			int negative = 0;
			
			for ( int i = 0; i < numberOfTrees; i++ )
			{
				kindOfTree = Utility.Random( 4 );
				
				randomValueX = Utility.Random( 20 );
				negative = Utility.Random( 2 );
				if ( negative > 0 )
					randomValueX *= -1;
					
				negative = Utility.Random( 2 );
				randomValueY = Utility.Random( 20 );
				if ( negative > 0 )
					randomValueY *= -1;
				
				switch ( kindOfTree )
				{
					case 0:
						{
							tree = new FieldTree1();
							break;
						}
					case 1:
						{
							tree = new FieldTree2();
							break;
						}
					case 2:
						{
							tree = new FieldTree3();
							break;
						}
					case 3:
						{
							tree = new FieldTree4();
							break;
						}
				}
				
				tree.Location = new Point3D((spawnpoint.X + randomValueX), (spawnpoint.Y + randomValueY), (spawnpoint.Z));
				tree.Map = spawnmap;
				Trees.Add(tree);
			}
		}