blob: cb3377055bae6a43a121c691f11f819fcf46a061 (
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
|
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityString
{
[TaskCategory("Basic/String")]
[TaskDescription("Compares the first string to the second string. Returns an int which indicates whether the first string precedes, matches, or follows the second string.")]
public class CompareTo : Action
{
[Tooltip("The string to compare")]
public SharedString firstString;
[Tooltip("The string to compare to")]
public SharedString secondString;
[Tooltip("The stored result")]
[RequiredField]
public SharedInt storeResult;
public override TaskStatus OnUpdate()
{
storeResult.Value = firstString.Value.CompareTo(secondString.Value);
return TaskStatus.Success;
}
public override void OnReset()
{
firstString = "";
secondString = "";
storeResult = 0;
}
}
}
|