daily pastebin goal
46%
SHARE
TWEET

vMeleeManager/CanBlockAttack

Darkhitori Jan 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Darkhitori v1.0
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using Invector;
  6.  
  7. namespace HutongGames.PlayMaker.Actions
  8. {
  9.     [ActionCategory("Invector/vMeleeManager")]
  10.     [Tooltip("Check if attack can be blocked ")]
  11.     public class vMM_CanBlockAttack : FsmStateAction
  12.     {
  13.         [RequiredField]
  14.         [CheckForComponent(typeof(vMeleeManager))]
  15.         public FsmOwnerDefault gameObject;
  16.        
  17.         public FsmVector3 attackPoint;
  18.        
  19.         [ActionSection("Return")]
  20.         [UIHint(UIHint.FsmBool)]
  21.         public FsmBool canBlockAttack;
  22.        
  23.         public FsmBool everyFrame;
  24.  
  25.         vMeleeManager theScript;
  26.  
  27.         public override void Reset()
  28.         {
  29.             gameObject = null;
  30.             attackPoint = new Vector3(0,0,0);
  31.             canBlockAttack = false;
  32.             everyFrame = true;
  33.         }
  34.        
  35.         public override void OnEnter()
  36.         {
  37.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  38.  
  39.             theScript = go.GetComponent<vMeleeManager>();
  40.  
  41.  
  42.             if (!everyFrame.Value)
  43.             {
  44.                 DoTheMagic();
  45.                 Finish();
  46.             }
  47.  
  48.         }
  49.  
  50.         public override void OnUpdate()
  51.         {
  52.             if (everyFrame.Value)
  53.             {
  54.                 DoTheMagic();
  55.             }
  56.         }
  57.  
  58.         void DoTheMagic()
  59.         {
  60.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  61.             if (go == null)
  62.             {
  63.                 return;
  64.             }
  65.            
  66.             canBlockAttack.Value = theScript.CanBlockAttack(attackPoint.Value);            
  67.         }
  68.  
  69.     }
  70. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top