1
- using System ;
2
- using JetBrains . Annotations ;
3
- using TLP . UdonUtils . Runtime . Common ;
4
- using TLP . UdonUtils . Runtime . Player ;
1
+ using JetBrains . Annotations ;
5
2
using UnityEngine ;
6
3
using VRC . SDKBase ;
7
4
8
5
namespace TLP . UdonUtils . Runtime . Experimental . Tasks
9
6
{
10
7
public enum TaskState
11
8
{
9
+ Finished ,
12
10
Pending ,
13
- Running ,
14
- Finished
11
+ Running
15
12
}
16
13
17
14
public enum TaskResult
@@ -30,15 +27,16 @@ public abstract class Task : TlpBaseBehaviour
30
27
public override int ExecutionOrderReadOnly => ExecutionOrder ;
31
28
32
29
[ PublicAPI ]
33
- public new const int ExecutionOrder = TLP . UdonUtils . Runtime . Pool . Pool . ExecutionOrder + 50 ;
30
+ public new const int ExecutionOrder = Runtime . Pool . Pool . ExecutionOrder + 50 ;
34
31
#endregion
35
32
36
- public TaskState State { get ; private set ; }
37
- public TaskResult Result { get ; private set ; }
33
+ public TaskState State { get ; private set ; } = TaskState . Finished ;
34
+ public TaskResult Result { get ; private set ; } = TaskResult . Unknown ;
38
35
39
36
internal TaskScheduler DefaultScheduler ;
40
37
internal TaskScheduler ActiveScheduler ;
41
38
internal TlpBaseBehaviour TaskInstigator ;
39
+
42
40
/// <summary>
43
41
/// In range 0 - 1 (inclusive)
44
42
/// </summary>
@@ -61,7 +59,6 @@ internal bool PrepareForRun() {
61
59
Result = TaskResult . Failed ;
62
60
State = TaskState . Finished ;
63
61
return false ;
64
-
65
62
}
66
63
67
64
public bool Abort ( ) {
@@ -83,6 +80,7 @@ public bool Abort() {
83
80
ActiveScheduler . CancelTask ( this ) ;
84
81
return true ;
85
82
}
83
+
86
84
Error ( $ "{ nameof ( Abort ) } : was not scheduled") ;
87
85
return false ;
88
86
}
@@ -122,6 +120,13 @@ public TaskState Run() {
122
120
123
121
#region Internal
124
122
protected void SetProgress ( float progress ) {
123
+ #region TLP_DEBUG
124
+ #if TLP_DEBUG
125
+ DebugLog ( $ "{ nameof ( SetProgress ) } : { nameof ( progress ) } ={ progress } ") ;
126
+ #endif
127
+ #endregion
128
+
129
+
125
130
Progress = Mathf . Clamp01 ( progress ) ;
126
131
}
127
132
0 commit comments