protected void Update() { if (m_uiActive && !deleteFlag) { if (player.currentTool == gatherTool && drops != null) { UIConstructor uic = m_currentUIWrapper.GetComponent <UIConstructor>(); uic.Flush(); foreach (var option in drops.m_options) { float prob = (option.m_weight / drops.m_totalWeight); string weightText = (prob * 100.0f).ToString() + "%"; Color col = prob > 0.25f ? Color.black : Color.red; uic.AddSlot(option.m_type, weightText, col); } } } }
// Update is called once per frame new void Update() { base.Update(); if (m_uiActive) { if (m_ruined && player.currentTool == repairTool) { UIConstructor uic = m_currentUIWrapper.GetComponent <UIConstructor>(); uic.Flush(); var cp = ResourceManager.GetCostProfile(m_type); foreach (var res in cp.m_buildingCost) { Color col = res.m_viabilityBool ? Color.black : Color.red; uic.AddSlot(res.m_type, res.m_delta.ToString(), col); } } else if (!m_ruined) { UIConstructor uic = m_currentUIWrapper.GetComponent <UIConstructor>(); uic.Flush(); var cy = ResourceManager.GetCurrentYields(m_type); Color col = cy.m_maxed ? Color.black : Color.red; for (int i = 0; i < ResourceManager.ResourceTypeCount; i++) { ResourceTypes resType = (ResourceTypes)i; if (cy.m_maxDeltas.ContainsKey(resType)) { if (cy.m_maxDeltas[resType] != 0.0f) { print("add slot " + resType); uic.AddSlot(resType, cy.m_currentDeltas[resType].ToString(), col); } } } } } }