Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Darkhitori v1.0
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using MLSpace;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory("CombatFramework/Ledge2LedgeTrigger")]
- [Tooltip("Get closest point from point to transforms width line. ")]
- public class CF_closestPointOnTransformWidthLine : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(Ledge2LedgeTrigger))]
- public FsmOwnerDefault gameObject;
- public FsmGameObject t;
- public FsmVector3 toPoint;
- [ActionSection("Return")]
- [UIHint(UIHint.FsmVector3)]
- public FsmVector3 closest;
- public FsmBool everyFrame;
- Ledge2LedgeTrigger theScript;
- public override void Reset()
- {
- gameObject = null;
- t = null;
- toPoint = null;
- closest = new Vector3(0,0,0);
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<Ledge2LedgeTrigger >();
- if (!everyFrame.Value)
- {
- DoTheMethod();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMethod();
- }
- }
- void DoTheMethod()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- closest.Value = theScript.closestPointOnTransformWidthLine(t.Value.transform, toPoint.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement