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/vMeleeManager")]
- [Tooltip("Check if attack can be blocked ")]
- public class vMM_CanBlockAttack : FsmStateAction
- {
- [RequiredField]
- [CheckForComponent(typeof(vMeleeManager))]
- public FsmOwnerDefault gameObject;
- public FsmVector3 attackPoint;
- [ActionSection("Return")]
- [UIHint(UIHint.FsmBool)]
- public FsmBool canBlockAttack;
- public FsmBool everyFrame;
- vMeleeManager theScript;
- public override void Reset()
- {
- gameObject = null;
- attackPoint = new Vector3(0,0,0);
- canBlockAttack = false;
- everyFrame = true;
- }
- public override void OnEnter()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- theScript = go.GetComponent<vMeleeManager>();
- if (!everyFrame.Value)
- {
- DoTheMagic();
- Finish();
- }
- }
- public override void OnUpdate()
- {
- if (everyFrame.Value)
- {
- DoTheMagic();
- }
- }
- void DoTheMagic()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- canBlockAttack.Value = theScript.CanBlockAttack(attackPoint.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement