daily pastebin goal
17%
SHARE
TWEET

v_AIController/OnRecoil

Darkhitori Jan 13th, 2018 55 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/v_AIController")]
  10.     [Tooltip(" ")]
  11.     public class vAIC_OnRecoil : FsmStateAction
  12.     {
  13.         [RequiredField]
  14.         [CheckForComponent(typeof(v_AIController))]
  15.         public FsmOwnerDefault gameObject;
  16.        
  17.         public FsmInt recoilID;
  18.        
  19.         public FsmEvent sendEvent;
  20.        
  21.         public FsmBool everyFrame;
  22.  
  23.         v_AIController theScript;
  24.  
  25.  
  26.         public override void Reset()
  27.         {
  28.             gameObject = null;
  29.             recoilID = null;
  30.             sendEvent = null;
  31.             everyFrame = true;
  32.         }
  33.        
  34.         public override void OnEnter()
  35.         {
  36.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  37.  
  38.             theScript = go.GetComponent<v_AIController>();
  39.  
  40.  
  41.             if (!everyFrame.Value)
  42.             {
  43.                 DoTheMagic();
  44.                 Finish();
  45.             }
  46.  
  47.         }
  48.  
  49.         public override void OnUpdate()
  50.         {
  51.             if (everyFrame.Value)
  52.             {
  53.                 DoTheMagic();
  54.             }
  55.         }
  56.  
  57.         void DoTheMagic()
  58.         {
  59.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  60.             if (go == null)
  61.             {
  62.                 return;
  63.             }
  64.            
  65.             theScript.OnRecoil(recoilID.Value);  
  66.             if(sendEvent == null)
  67.             {
  68.                 return;
  69.             }
  70.             else
  71.             {
  72.                 Fsm.Event(sendEvent);
  73.             }
  74.         }
  75.  
  76.     }
  77. }
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