Skip to main content

PlayerCharacterStats.AddAddOnPlugins

Declaration#

public virtual void AddAddOnPlugins(AddOnPlugin addOn, BasicInfo info, IUniquelyIdentifiable source, Action<List<ISelectableOption>> resultsCallback)

Parameters#

NameDescription
addOnPlugin to add
infoInformation about the plugin
sourceSource associated with add-on
resultsCallbackCallback to invoke with results upon completion

Description#

Adds one or more Add-On Plugin

Usage#

Example
using NullSave.GDTK;using NullSave.GDTK.Stats;using System;using System.Collections;using System.Collections.Generic;using UnityEngine;
public class Example : MonoBehaviour{
    public IEnumerator ExampleMethod(PlayerCharacterStats source, GDTKLevelReward reward)    {        bool canContinue;
        // Clone item to ensure we don't set database data        GDTKLevelReward rewardClone = reward.Clone();
        // Create a callback        Action<List<ISelectableOption>> callback = l =>        {            canContinue = true;        };
        // Add Add-Ons        foreach (AddOnWrapper wrapper in rewardClone.addOnPlugins)        {            canContinue = false;            source.AddAddOnPlugins(wrapper.plugin, null, callback);            while (!canContinue) yield return new WaitForEndOfFrame();        }    }
}