PlayerCharacterStats.SubscribeToFocusChange
Declaration#
public virtual void SubscribeToFocusChange(SimpleEvent handler, string focusId)Parameters#
| Name | Description |
|---|---|
| handler | Handler to invoke on change |
| focusId | Id of the focus to subscribe to |
Description#
Subscribe to Focus changes
Usage#
Example
using NullSave.GDTK.Stats;using UnityEngine;
public class Example : MonoBehaviour{
int i = 0; PlayerCharacterStats source; string id;
public void ExampleMethod(PlayerCharacterStats target, string focusId) { source = target; id = focusId; target.SubscribeToFocusChange(FocusChange, focusId); }
private void FocusChange() { i++; Debug.Log("Focus Changed (" + i + ")"); if (i >= 5) { source.UnsubscribeFromFocusChange(FocusChange, id); } }}