-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patharrayRemove.cs
41 lines (33 loc) · 928 Bytes
/
arrayRemove.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
36
37
38
39
40
41
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Array)]
[Tooltip("Remove an item from an array")]
public class arrayRemove : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The Array Variable to use.")]
public FsmArray array;
[RequiredField]
[MatchElementType("array")]
[Tooltip("Item to add.")]
public FsmVar value;
public override void Reset()
{
array = null;
value = null;
}
public override void OnEnter()
{
DoAddValue();
Finish();
}
private void DoAddValue()
{
array.Resize(array.Length + 1);
value.UpdateValue();
array.Set(array.Length - 1, value.GetValue());
}
}
}