Exemplo n.º 1
0
        private void RenderSectors()
        {
            WorldService.GetPopulationDensity(response =>
            {
                for (int index = 0; index < response.density.Length; index++)
                {
                    int population = response.density[index];
                    Sector sector  = Instantiate(sectorPrefab, worldContainer);
                    sector.Id      = index + 1;
                    sector.SetText(population.ToString());
                    sector.MouseClickEvent.AddListener(() => OnSectorSelected(sector));
                    sector.MouseDoubleClickEvent.AddListener(() =>
                    {
                        OnSectorSelected(sector);
                        OnSelectClick();
                    });

                    _sectors.Add(sector);
                }
            }, Debug.Log);

            overlay.SetActive(false);
        }