Example #1
0
        private void HandleDemandGenerated(Demand demand)
        {
            // it definitely should be poolable but I want to finish this project finally
            UIDemand uiDemand = Instantiate(m_DemandPrefab, m_DemandsRoot);

            uiDemand.Initialize(demand.Resource.ResourceBlueprint.Sprite, demand.DemandValue);
            m_Demands.Add(demand, uiDemand);
        }
Example #2
0
        private void HandleDemandRemoved(Demand demand)
        {
            if (m_Demands.ContainsKey(demand))
            {
                UIDemand uiDemand = m_Demands[demand];

                if (uiDemand != null)
                {
                    Destroy(uiDemand.gameObject);
                }

                m_Demands.Remove(demand);
            }
            else
            {
                Debug.LogWarningFormat("Trying to remove Demand from DemandPoint that's not here: {0}", demand.Resource.ResourceBlueprint.Name);
            }
        }