I tried my best to make an action script for playmaker but, I didn't get very far, spent a few hours looking at the API reference, there's a lot of TODO for the classes, not blaming that, but I need help please
Function Description : Gets distance between two gameobjects ignoring an AXIS (y).
I would like if a staff member could help me please. Thank you!
using UnityEngine;
using System.Collections;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GameObject)]
[Tooltip("Gets distance without the Y axis involved.")]
public class GetDistNoY : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.FsmGameObject)]
public FsmGameObject objectSrc;
[UIHint(UIHint.FsmGameObject)]
public FsmOwnerDefault objectDest;
[UIHint(UIHint.FsmFloat)]
public FSMFloat storeResult;
public bool everyFrame;
public override void Reset()
{
definition = null;
theValue = null;
storeResult = null;
everyFrame = false;
}
public override void OnEnter()
{
DoFindDistanceNoY();
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
DoFindDistanceNoY();
}
void DoFindDistanceNoY()
{
Transform transformSrc = objectSrc.GetComponent<Transform>();
Transform transformDest = objectDest.GetComponent<Transform>();
storeResult.Value = transformSrc.position.x;
print(storeResult.Value);
}
}
}