Example #1
0
    public void createLocationButtons()
    {
        Button[] allButtons = myMapPanel.GetComponentsInChildren <Button>();

        foreach (Button b in allButtons)
        {
            if (!(b.gameObject.name.ToLower() == "closemapbutton"))
            {
                Destroy(b.gameObject);
            }
        }

        for (int j = 0; j < numberOfRows; j++)
        {
            for (int k = 0; k < mapColumnLengths[j]; k++)
            {
                //TODO make this int 4 more flexible (accommodating for various map sizes. Maybe make it the length of the largest row in mapColumnLenghts?)
                int mapButtonIndex = j * 4 + k;

                if (mapButtonIndex >= mySceneCatalogue.getLocationCount())
                {
                    return;
                }

                if (!mySceneCatalogue.locations[mapButtonIndex].isKnown)
                {
                    continue;
                }

                createLocationButton(j, k, mapButtonIndex);
            }
        }
    }