-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathenableColliderList.cs
40 lines (32 loc) · 1007 Bytes
/
enableColliderList.cs
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
39
40
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityboxCollider
{
[TaskCategory("Basic/boxCollider")]
[TaskDescription("Enables/Disables a Box collider list.")]
public class enableColliderList : Action
{
public SharedColliderList colliderList;
public SharedBool enable;
public override TaskStatus OnUpdate()
{
if(colliderList.Value == null)
{
return TaskStatus.Success;
}
if(colliderList.Value.Count == 0)
{
return TaskStatus.Success;
}
for (int index = 0; index < colliderList.Value.Count; index++)
{
var coll = colliderList.Value[index];
coll.enabled = enable.Value;
}
return TaskStatus.Success;
}
public override void OnReset()
{
enable = false;
}
}
}