blob: c34c4133b3726d4ea2dc95fdc332f7b62553ac9a (
plain)
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
|
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityBehaviour
{
[TaskCategory("Basic/Behaviour")]
[TaskDescription("Stores the enabled state of the object. Returns Success.")]
public class GetIsEnabled : Action
{
[Tooltip("The Object to use")]
public SharedObject specifiedObject;
[Tooltip("The enabled/disabled state")]
[RequiredField]
public SharedBool storeValue;
public override TaskStatus OnUpdate()
{
if (specifiedObject == null && !(specifiedObject.Value is UnityEngine.Behaviour)) {
Debug.LogWarning("SpecifiedObject is null or not a subclass of UnityEngine.Behaviour");
return TaskStatus.Failure;
}
storeValue.Value = (specifiedObject.Value as Behaviour).enabled;
return TaskStatus.Success;
}
public override void OnReset()
{
if (specifiedObject != null) {
specifiedObject.Value = null;
}
storeValue = false;
}
}
}
|