blob: 9bf51c68e2b7cac96ff6bbcfe541b79a1327465a (
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
|
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityVector3
{
[TaskCategory("Basic/Vector3")]
[TaskDescription("Stores the magnitude of the Vector3.")]
public class GetMagnitude : Action
{
[Tooltip("The Vector3 to get the magnitude of")]
public SharedVector3 vector3Variable;
[Tooltip("The magnitude of the vector")]
[RequiredField]
public SharedFloat storeResult;
public override TaskStatus OnUpdate()
{
storeResult.Value = vector3Variable.Value.magnitude;
return TaskStatus.Success;
}
public override void OnReset()
{
vector3Variable = Vector3.zero;
storeResult = 0;
}
}
}
|