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/Trigger")]
- [Tooltip("Get closest point to this trigger. Return null to disable. ")]
- public class CF_closestPoint : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(Trigger))]
- public FsmOwnerDefault gameObject;
- public FsmVector3 toPoint;
- public FsmBool everyFrame;
- Trigger theScript;
- public override void Reset()
- {
- gameObject = null;
- toPoint = new Vector3(0,0,0);
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<Trigger>();
- if (!everyFrame.Value)
- {
- DoTheMethod();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMethod();
- }
- }
- void DoTheMethod()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- theScript.closestPoint(toPoint.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement