forked from mdotstrange/CustomBehaviorDesignerTasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisGoActiveNotNull.cs
35 lines (29 loc) · 919 Bytes
/
isGoActiveNotNull.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
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityGameObject
{
[TaskCategory("Basic/GameObject")]
[TaskDescription("Returns success if the target is still active and not null.")]
public class isGoActiveNotNull : Action
{
public SharedGameObject targetGameObject;
public override TaskStatus OnUpdate()
{
if(targetGameObject.Value == null)
{
return TaskStatus.Failure;
}
if (targetGameObject.Value.gameObject.activeInHierarchy == true && targetGameObject.Value != null)
{
return TaskStatus.Success;
}
else
{
return TaskStatus.Failure;
}
}
public override void OnReset()
{
targetGameObject = null;
}
}
}