Hi,
Ok, here we go:
I have put together a simple custom action using string.Format so that you can compose a string with an int in a very powerful way.
some good examples of what can be achieved:
http://www.csharp-examples.net/string-format-int/Please find the code below
If you need this for floats, strings, etc, just shout or simply duplicate this action and change the Fsm type to match your need. A simple and good exercices if you want to start making custom actions.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.String)]
[Tooltip("Builds a String using Format() method for an int.")]
public class StringFormat : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.FsmString)]
public FsmString definition;
[UIHint(UIHint.FsmInt)]
public FsmInt theValue;
[UIHint(UIHint.Variable)]
public FsmString storeResult;
public bool everyFrame;
public override void Reset()
{
definition = null;
theValue = null;
storeResult = null;
everyFrame = false;
}
public override void OnEnter()
{
DoStringFormat();
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
DoStringFormat();
}
void DoStringFormat()
{
if (storeResult == null) return;
storeResult.Value = string.Format(definition.Value,theValue.Value);
}
}
}
Bye,
Jean