Beispiel #1
0
    public HexCell GetRandomCellToSpawnEvent()
    {
        // make it centered
        int     ranX = Random.Range(mapWidth / 4, mapWidth / 4 * 3);
        int     ranY = Random.Range(mapHeight / 4, mapHeight / 4 * 3);
        HexCell cell = cells[ranX + ranY * mapWidth];

        while (!cell.CanbeEventDestination())
        {
            ranX = Random.Range(mapWidth / 4, mapWidth / 4 * 3);
            ranY = Random.Range(mapHeight / 4, mapHeight / 4 * 3);
            cell = cells[ranX + ranY * mapWidth];
        }
        return(cell);
    }