예제 #1
0
        public void Init(int index, LocalStat rawProduciton, LocalStat sectorProduction)
        {
            _sectorLabel.text = "Sector " + index.ToString();
            _rawProduction    = rawProduciton;
            _sectorProduction = sectorProduction;

            UpdateLabels();
        }
예제 #2
0
        void InitializeComponents()
        {
            Stat rawProduction    = Registry.Get <Stat>(Code(STAT_RAW_PRODUCTION));
            Stat sectorProduction = Registry.Get <Stat>(Code(STAT_SECTOR_PROUCTION));

            Sectors = new Sector[3];
            for (int i = 0; i < Sectors.Length; i++)
            {
                LocalStat localRawProduction = new LocalStat(rawProduction);
                LocalStat localSectorProd    = new LocalStat(sectorProduction);

                // Dependencies can be added to individual sectors (local stats) as well
                // Uncomment to enable, and comment out  global dependency line in RegisterStats() method to avoid duplication.
                // localSectorProd.AddDependency(Registry.Get<Stat>(STAT_PRODUCTION_TECHNOLOGY.ToSlug()), 0.1f);

                Sectors[i] = _sectorUIContainer.GetChild(i).GetComponent <Sector>();
                Sectors[i].Init(i, localRawProduction, localSectorProd);
            }
        }