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 Invector;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory("Invector/vInput")]
- [Tooltip("Get Axis like a buttonUp Check if Axis is zero after press ")]
- public class vI_GetAxisButtonUp : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(vInput))]
- public FsmOwnerDefault gameObject;
- [ActionSection("Return")]
- [UIHint(UIHint.FsmBool)]
- public FsmBool getAxisButtonUp;
- [ActionSection("Event")]
- public FsmEvent sendEvent;
- public FsmBool everyFrame;
- GenericInput theScript;
- public override void Reset()
- {
- gameObject = null;
- sendEvent = null;
- getAxisButtonUp = false;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<GenericInput>();
- if (!everyFrame.Value)
- {
- DoTheMagic();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMagic();
- }
- }
- void DoTheMagic()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- getAxisButtonUp.Value = theScript.GetAxisButtonUp();
- if (getAxisButtonUp.Value)
- {
- Fsm.Event(sendEvent);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement