Ok, I am not a coder but keeping attention on how PM scripts work I made a custom action. It works flawlessly, but I don't know if there is some mistake in the script. I doubt if "using Unityengine" and "using System.collections" is right, but otherwise Mathf.Sign was "not present in the current context".
The code:
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
using System.Collections;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("Returns 1 for positive or -1 for negative")]
public class FloatSign : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatVariable;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatSign;
public bool everyFrame;
public override void Reset()
{
floatVariable = null;
floatSign = null;
everyFrame = false;
}
public override void OnEnter()
{
floatSign.Value = Mathf.Sign (floatVariable.Value);
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
floatSign.Value = Mathf.Sign (floatVariable.Value);
}
}
}