Files
unity-iso-tools/Assets/PlayMaker/Actions/Array/ArrayReverse.cs
2015-12-13 14:35:35 +06:00

33 lines
689 B
C#
Executable File

// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved.
using UnityEngine;
using System.Collections.Generic;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Array)]
[Tooltip("Reverse the order of items in an Array.")]
public class ArrayReverse : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The Array to reverse.")]
public FsmArray array;
public override void Reset()
{
array = null;
}
// Code that runs on entering the state.
public override void OnEnter()
{
var _list = new List<object>(array.Values);
_list.Reverse();
array.Values = _list.ToArray();
Finish();
}
}
}