Esempio n. 1
0
 public void Bulldoze()
 {
     CF.DestroyCell(Cell.getHexCoords(transform.position, 55f / 64f));
 }
Esempio n. 2
0
    private void Start()
    {
        grassFactory.generateGrid(new Vector2Int(xSize, ySize));
        //CreateShape();

        //genPatch(new Vector2Int(20, 20), 7,50, 0);

        genRocks(5);

        //genRocks();

        int        size;
        Vector2Int pos   = new Vector2Int(0, 0);
        Vector2Int delta = new Vector2Int(1, -4);
        Vector2Int gPos  = new Vector2Int(xSize / 2, ySize / 2);

        for (int i = 0; i < 5 + Random.Range(0, 2); i++)
        {
            size  = 1 + Random.Range(0, 3);
            pos.x = Random.Range(0, xSize);
            pos.y = Random.Range(0, ySize);
            genLooseSpot(pos, new Vector2Int(1, size), 9);
            genLooseSpot(pos, new Vector2Int(1, size), 9);
        }
        for (int i = 0; i < 3 + Random.Range(0, 2); i++)
        {
            do
            {
                size  = 2 + Random.Range(0, 4);
                pos.x = Random.Range(0, xSize);
                pos.y = Random.Range(0, ySize);
            } while (Mathf.Abs(pos.x - gPos.x) < (size - 2) || Mathf.Abs(pos.y - gPos.y) < 3);

            genSpot(pos + delta, new Vector2Int(1, size + 4), 8);

            genSpot(pos, new Vector2Int(2, size), 7);
            if (Random.Range(0, 2) == 1)
            {
                // do poprwaienia
                //genPatch(pos, 7, xSize + ySize, Random.Range(0, 7));
            }
        }

        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 5; j++)
            {
                if (Mathf.Pow(i, 2) + Mathf.Pow(j, 2) < 25)
                {
                    // Water condition
                    pos = new Vector2Int(i, j);
                    grassFactory.DestroyCell(grassFactory.Find(gPos + pos));
                    grassFactory.Add(gPos + pos, Random.Range(0, 2)).transform.localRotation = Quaternion.Euler(0, 0, 60 * Random.Range(1, 7));

                    pos.x = -pos.x;
                    grassFactory.DestroyCell(grassFactory.Find(gPos + pos));
                    grassFactory.Add(gPos + pos, Random.Range(0, 2)).transform.localRotation = Quaternion.Euler(0, 0, 60 * Random.Range(1, 7));

                    pos.y = -pos.y;
                    grassFactory.DestroyCell(grassFactory.Find(gPos + pos));
                    grassFactory.Add(gPos + pos, Random.Range(0, 2)).transform.localRotation = Quaternion.Euler(0, 0, 60 * Random.Range(1, 7));

                    pos.x = -pos.x;
                    grassFactory.DestroyCell(grassFactory.Find(gPos + pos));
                    grassFactory.Add(gPos + pos, Random.Range(0, 2)).transform.localRotation = Quaternion.Euler(0, 0, 60 * Random.Range(1, 7));
                }
            }
        }
        //CellFactory.cellCount = 0;
        //genSpot(new Vector2Int(10, 9), new Vector2Int(1, 6), 8);//genRocks(5);
    }