blob: 89db0f6e5dcf87f67b616601f70beb1fd2d8547d (
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
|
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityString
{
[TaskCategory("Basic/String")]
[TaskDescription("Replaces a string with the new string")]
public class Replace : Action
{
[Tooltip("The target string")]
public SharedString targetString;
[Tooltip("The old replace")]
public SharedString oldString;
[Tooltip("The new string")]
public SharedString newString;
[Tooltip("The stored result")]
[RequiredField]
public SharedString storeResult;
public override TaskStatus OnUpdate()
{
storeResult.Value = targetString.Value.Replace(oldString.Value, newString.Value);
return TaskStatus.Success;
}
public override void OnReset()
{
targetString = "";
oldString = "";
newString = "";
storeResult = "";
}
}
}
|