public void OnUpgradeButtonClicked(){
if(m_CurrentResearchItem != null){
switch (m_CurrentResearchItem.State)
{
case ResearchItemState.Unresearched:{
if(m_CurrentResearchItem.CanResearch()){
m_CurrentResearchItem.StartResearch();
}
break;
}
case ResearchItemState.InResearch:{
//TODO:Spend money and finish immediatly
m_CurrentResearchItem.ResearchFinished();
break;
}
default:
break;
}
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!
Where/how do you get the m_CurrentResearchItem in your code?
For research to work properly, the research tree/item instances need to come from the combatant's research handler, which has options for this via the combatant instance's property:
combatant.Research
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!