Exemplo n.º 1
0
    public void setupIndustryTiles()
    {
        Start();
        industryArea.Clear();
        // -2 = industry
        // -1 = nothing;
        int x = Random.Range(0, rows);
        int y = Random.Range(0, cols);
        // int x = testX;
        // int y = testY;
        bool oddN = (x + 1) % 2 == 0;
        int  amt  = 0;

        if ((x == 0 && y == 0) || (x == 5 && y == 8))
        {
            amt = 7;
        }
        else if ((x == 5 && y == 0) || (x == 0 && y == 8))
        {
            amt = 8;
        }
        else
        {
            amt = Random.Range(8, 13);
        }

        temp(x, y);

        if (oddN)
        {
            temp(x - 1, y);
            temp(x - 1, y + 1);
            temp(x, y - 1);
            temp(x, y + 1);
            temp(x + 1, y);
            temp(x + 1, y + 1);
        }
        else
        {
            temp(x - 1, y - 1);
            temp(x - 1, y);
            temp(x, y - 1);
            temp(x, y + 1);
            temp(x + 1, y);
            temp(x + 1, y - 1);
        }

        while (industryArea.Count < amt)
        {
            if (oddN)
            {
                industEVEN(x, y);
            }
            else
            {
                industODD(x, y);
            }
        }

        setupBoard();
        hm.Setup(this);
    }