Esempio n. 1
0
    public void UpdateBiomeOnMap()
    {
        if (myRoomImages != null)
        {
            for (int i = 0; i < myRoomImages.Length; ++i)
            {
                Destroy(myRoomImages[i].gameObject);
            }
        }

        int biomeSideSize = Data.myBiomeSideSize;

        myRoomImages = new Image[biomeSideSize * biomeSideSize];

        Color transparent = Color.white;

        transparent.a = 0;

        for (int y = 0; y < biomeSideSize; ++y)
        {
            for (int x = 0; x < biomeSideSize; ++x)
            {
                Image img = Instantiate(myRoomImagePrefab, myGridLayoutGroup.transform);
                myRoomImages[y * biomeSideSize + x] = img;

                if (myWorldGeneration.GetCurrentActiveBiome().GetRoom(x, y) != null)
                {
                    Color col = Color.grey;
                    col.a     = 0.25f;
                    img.color = col;
                }
                else
                {
                    img.color = transparent;
                }
            }
        }

        for (int i = 0; i < myVisitedRooms.Count; i++)
        {
            if (myVisitedRooms[i].GetBiome() == myWorldGeneration.GetCurrentActiveBiome())
            {
                SetRoomVisited(myVisitedRooms[i]);
            }
        }
    }