Example #1
0
    void SetVisibility()
    {
        visibilityManager.SetRoomCount(rooms.Count);
        List <GameObject> tileList = tileRenderer.TileList;

        foreach (GameObject tile in tileList)
        {
            if (!tile.GetComponent <VisibilityItem>())
            {
                continue;
            }

            for (int i = 0; i < rooms.Count; i++)
            {
                Room room = rooms[i];

                if (tile.transform.position.x >= room.rectangle.xMin - 1 &&
                    tile.transform.position.x <= room.rectangle.xMax + 1 &&
                    tile.transform.position.z >= room.rectangle.yMin - 1 &&
                    tile.transform.position.z <= room.rectangle.yMax + 1)
                {
                    visibilityManager.AddItemToRoom(tile.GetComponent <VisibilityItem>(), i);
                }
            }
        }

        visibilityManager.ShowItemsInRoom(0);
    }