Example #1
0
        void CreateNextPart()
        {
            if (newWidth <= 0 || newDepth <= 0)
            {
                return;
            }
            BuildingParameters param = (BuildingParameters)parameters;

            double randomValue = param.Rand.NextDouble();

            if (randomValue < param.RoofContinueChance || HeightRemaining <= 0)             // continue with the roof
            {
                Roof nextRoof = CreateSymbol <Roof>("roof");
                nextRoof.Initialize(newWidth, newDepth, HeightRemaining);
                nextRoof.Generate(param.buildDelay);
            }
            else                 // continue with a stock
            {
                Stock nextStock = CreateSymbol <Stock>("stock");
                nextStock.Initialize(newWidth, newDepth, HeightRemaining);
                nextStock.Generate(param.buildDelay);
            }
        }
Example #2
0
        protected override void Execute()
        {
            

            
            GameObject[] walls = new GameObject[4];

           

            for (int i = 0; i < 4; i++)
            {
                Vector3 localPosition = new Vector3();
                switch (i)
                {
                    case 0:
                        localPosition = new Vector3(-(Width - 1) * 0.5f, 0, 0); // left
                        break;
                    case 1:
                        localPosition = new Vector3(0, 0, (Depth - 1) * 0.5f); // back
                        break;
                    case 2:
                        localPosition = new Vector3((Width - 1) * 0.5f, 0, 0); // right
                        break;
                    case 3:
                        localPosition = new Vector3(0, 0, -(Depth - 1) * 0.5f); // front
                        break;
                }
                Row newRow = CreateSymbol<Row>("wall", localPosition, Quaternion.Euler(0, i * 90, 0), transform);

                if (HeightRemaining != param.maxHeight)
                {
                    newRow.Initialize(
                        i % 2 == 1 ? Width : Depth,
                        param.wallStyle,
                        param.wallPattern
                    );

                    Debug.Log("initializing normal wall");
                }
                else
                {
                    newRow.Initialize(
                    i % 2 == 1 ? Width : Depth,
                    param.wallStyle, param.doorStyle,
                    param.wallPattern
                );
                    Debug.Log("initializing doors");
                }

                newRow.Generate();
            }

            double randomValue = param.Rand.NextDouble();

            if (HeightRemaining > 0 && randomValue < param.StockContinueChance)
            {
                Stock nextStock = CreateSymbol<Stock>("stock", new Vector3(0, 1, 0), Quaternion.identity, transform);
                nextStock.Initialize(Width, Depth, HeightRemaining - 1);
                nextStock.Generate(param.buildDelay);
            }
            else
            {
                Roof nextRoof = CreateSymbol<Roof>("roof", new Vector3(0, 1, 0), Quaternion.identity, transform);
                nextRoof.Initialize(Width, Depth, HeightRemaining - 1);
                nextRoof.Generate(param.buildDelay);
            }
        }