API

TechtreeManager

ResearchTechInTechtree

Start a research. Returns the techtree node or null if failed (not enough resources).

public Techtree.TechtreeNode ResearchTechInTechtree(Techtree _techtree, string _techNodeID)
public Techtree.TechtreeNode ResearchTechInTechtree(Type _techtreeType, string _techtreeTitle, string _techNodeID)
private Techtree.TechtreeNode ResearchTechInTechtree(Type _techtreeType, string _techtreeTitle, string _techNodeID, Techtree _techtree)

Example

public TechtreeManager techtreeManager;

public void StartResearch()
{
    // Research the first node in the techtree. -1 is the node ID. This can be changed on the node
    var _node = techtreeManager.ResearchTechInTechtree(typeof(Techtree), "PlayerTechtree", "-1");
    
    if (_node != null)
    {
        // Subscribe to the on progress event
        _node.OnResearchProgress -= Progress;
        _node.OnResearchProgress += Progress;
    }
    else
    {
        // Research failed. Maybe because we don't have enough resources
        Debug.Log("Research failed, not enough resources");
    }
}

void Progress(float _progress)
{
    Debug.Log("progress: " + _value);
}

GetTechNode

Returns a techtree node. The techtree node contains properties like, unlocked or researched.

public Techtree.TechtreeNode GetTechNode(Type _techtreeType, string _techtreeTitle, string _techNodeID)

GetAllTechNodes

Returns all techtree nodes in a list from a techtree.

public List<Techtree.TechtreeNode> GetAllTechNodes(Type _techtreeType, string _techtreeTitle)

GetTechtree

Returns a techtree.

public Techtree GetTechtree(Type _techtreeType, string _techtreeTitle)

Last updated