NodeComponentのヘッダ部にプログレスバーを表示できます。
スクリプトの書き方
- LogicToolkit.IProgressComponentを各種NodeComponentを継承した型に実装する。
- public LogicToolkit.ProgressPlayer ProgressPlayer{ get; }を実装する。
- LogicToolkit.ProgressPlayerの- IsActiveプロパティでプログレスバーの表示を切り替える。
- LogicToolkit.ProgressPlayerの- CurrentProgressプロパティでプログレスバーの進捗度(0~1)を切り替える。
コード例
|  1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LogicToolkit;
[System.Serializable]
public class ProgressExample : TaskComponent, IProgressComponent
{
    private ProgressPlayer progressPlayer = new ProgressPlayer();
    public ProgressPlayer ProgressPlayer => progressPlayer;
    private float startTime;
    // OnActivated is called when activated.
    protected override void OnActivated()
    {
        progressPlayer.IsActive = true;
        progressPlayer.CurrentProgress = 0f;
        startTime = Time.time;
    }
    // OnExecute is called when it is executed.
    protected override TaskStatus OnExecute()
    {
        float progress = Time.time - startTime / 1f;
        progressPlayer.CurrentProgress = progress;
        // Return Running, Success, or Failure depending on the task execution status.
        return progress >= 1f? TaskStatus.Success : TaskStatus.Running;
    }
    // OnDeactivated is called when it is deactivated.
    protected override void OnDeactivated()
    {
        progressPlayer.IsActive = false;
    }
}
 | 
 
この例では、TaskComponentとして1秒待機中の進捗度をNodeComponentのヘッダ部にプログレスバーで表示しています。
なお、同様の機能としてWait For Secondsというスクリプトが予め同梱されています。