Exemplo n.º 1
0
        /// <summary>
        /// Finds a random component to tack on to the bridge. Or builds the end.
        /// </summary>
        private StructureComponent GetNextComponent(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List <StructureComponent> par2List, Random par3Random, int par4, int par5, int par6, int par7, int par8, bool par9)
        {
            if (Math.Abs(par4 - par1ComponentNetherBridgeStartPiece.GetBoundingBox().MinX) > 112 || Math.Abs(par6 - par1ComponentNetherBridgeStartPiece.GetBoundingBox().MinZ) > 112)
            {
                ComponentNetherBridgeEnd componentnetherbridgeend = ComponentNetherBridgeEnd.Func_40023_a(par2List, par3Random, par4, par5, par6, par7, par8);
                return(componentnetherbridgeend);
            }

            List <StructureNetherBridgePieceWeight> list = par1ComponentNetherBridgeStartPiece.Field_40035_b;

            if (par9)
            {
                list = par1ComponentNetherBridgeStartPiece.Field_40036_c;
            }

            ComponentNetherBridgePiece componentnetherbridgepiece = GetNextComponent(par1ComponentNetherBridgeStartPiece, list, par2List, par3Random, par4, par5, par6, par7, par8 + 1);

            if (componentnetherbridgepiece != null)
            {
                par2List.Add(componentnetherbridgepiece);
                par1ComponentNetherBridgeStartPiece.Field_40034_d.Add(componentnetherbridgepiece);
            }

            return(componentnetherbridgepiece);
        }
Exemplo n.º 2
0
        private ComponentNetherBridgePiece GetNextComponent(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List <StructureNetherBridgePieceWeight> par2List, List <StructureComponent> par3List, Random par4Random, int par5, int par6, int par7, int par8, int par9)
        {
            int  var10 = this.GetTotalWeight(par2List);
            bool var11 = var10 > 0 && par9 <= 30;
            int  var12 = 0;

            while (var12 < 5 && var11)
            {
                ++var12;
                int var13 = par4Random.Next(var10);
                IEnumerator <StructureNetherBridgePieceWeight> var14 = par2List.GetEnumerator();

                while (var14.MoveNext())
                {
                    StructureNetherBridgePieceWeight var15 = var14.Current;
                    var13 -= var15.Field_40697_b;

                    if (var13 < 0)
                    {
                        if (!var15.Func_40693_a(par9) || var15 == par1ComponentNetherBridgeStartPiece.Field_40037_a && !var15.Field_40696_e)
                        {
                            break;
                        }

                        ComponentNetherBridgePiece var16 = StructureNetherBridgePieces.CreateNextComponent(var15, par3List, par4Random, par5, par6, par7, par8, par9);

                        if (var16 != null)
                        {
                            ++var15.Field_40698_c;
                            par1ComponentNetherBridgeStartPiece.Field_40037_a = var15;

                            if (!var15.Func_40694_a())
                            {
                                par2List.Remove(var15);
                            }

                            return(var16);
                        }
                    }
                }
            }

            ComponentNetherBridgeEnd var17 = ComponentNetherBridgeEnd.Func_40023_a(par3List, par4Random, par5, par6, par7, par8, par9);

            return(var17);
        }