Custom Logic
How to implement custom logic.
Player Level
Skills support player level requirements—preventing upgrading if the required level is not met. If you'd like to use custom logic to get the player level, use the SkillNode.playerLevelGetter field.
By default, the SkillWeb.playerLevel field is used. The example below sets a custom one.
public class PlayerLevelGetterExample : MonoBehaviour
{
public int myPlayerLevel;
private void Awake()
{
SkillNode.playerLevelGetter = () =>
{
return myPlayerLevel;
};
}
}Custom Upgrade/Downgrade Logic
You can add on to the upgrade/downgrade prevention logic to add your own upgrade/downgrade requirements. You can implement your own logic by using the SkillNode.canUpgrade and SkillNode.canDowngrade fields. By default, both simply return true.
Skill Points Binding
Bind
By default, every Web simply uses the SkillWeb.skillPoints field as the reference of the player's current skill points. You can bind your own numeric skill points field for each web. The supported numeric types are int, float and double. The Bind method returns a SkillPointsBinding object.
Note: the Bind method will clear all previous bindings.
Add Binding
As of v1.5, you can bind multiple skill points to the same web—simply use AddBinding instead of Bind. The AddBinding method returns a SkillPointsBinding object.
Remove Binding
Both the Bind and AddBinding method return a SkillPointsBinding object, which you can use to track all bindings. To remove a binding, use RemoveBinding.
Custom Upgrade/Downgrade Flow
By default, the UI simply upgrades or downgrades a skill when you click on a skill node with the appropriate button. You can actually override this behavior by implementing your own version of the skill node by inheriting from the Skill Node UGUI class.
This new class would have to replace the Skill Node UGUI component of your skill node prefab.
The example below uses a custom dialog box which will only allow downgrading if the "Confirm" button is pressed.
Last updated