public void Initialize(bool isDisabled, SOResearch research) { Research = research; image.texture = research.icon; if (isDisabled) { Disable(); } }
void Update() { if (CurrentState == BaseNodeState.Idle && CurrentResearch != null) { CurrentState = BaseNodeState.Researching; setMaterialProperties.SetMaterial(1f, TeamColors.Hues[Team], BaseNodeData.sprite); } if (CurrentState == BaseNodeState.Researching && researchProgress >= CurrentResearch.cost) { CurrentState = BaseNodeState.Idle; researchProgress = 0; ResearchCompleted?.Invoke(CurrentResearch, Team); int[] techResearched = uiController.Store["TechResearched"]; techResearched[Team]++; uiController.SetValue("TechResearched", techResearched); CurrentResearch = null; setMaterialProperties.SetMaterial(0f, TeamColors.Hues[Team], BaseNodeData.sprite); } }
void OnResearchCompleted(SOResearch research, int team) { uiController.Store["CompletedResearch"][team].Add(research); uiController.UpdateValue("CompletedResearch"); Debug.Log("New research completed: " + research.description + " on team: " + team.ToString()); }
void OnResearchComponentClicked(SOResearch researchData) { selectedNode.CurrentResearch = researchData; }