Darkhitori

vShooterManager/GetReloadID

Jan 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. //Darkhitori v1.0
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using Invector;
  6. using Invector.ItemManager;
  7.  
  8. namespace HutongGames.PlayMaker.Actions
  9. {
  10.     [ActionCategory("Invector/vShooterManager")]
  11.     [Tooltip(" ")]
  12.     public class vSM_GetReloadID : FsmStateAction
  13.     {
  14.         [RequiredField]
  15.         [CheckForComponent(typeof(vShooterManager))]
  16.         public FsmOwnerDefault gameObject;
  17.        
  18.         [ActionSection("Return")]
  19.         [UIHint(UIHint.FsmInt)]
  20.         public FsmInt reloadID;
  21.        
  22.         public FsmBool everyFrame;
  23.  
  24.         vShooterManager theScript;
  25.  
  26.         public override void Reset()
  27.         {
  28.             gameObject = null;
  29.             reloadID = null;
  30.             everyFrame = true;
  31.         }
  32.        
  33.         public override void OnEnter()
  34.         {
  35.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  36.  
  37.             theScript = go.GetComponent<vShooterManager>();
  38.  
  39.  
  40.             if (!everyFrame.Value)
  41.             {
  42.                 DoTheMagic();
  43.                 Finish();
  44.             }
  45.  
  46.         }
  47.  
  48.         public override void OnUpdate()
  49.         {
  50.             if (everyFrame.Value)
  51.             {
  52.                 DoTheMagic();
  53.             }
  54.         }
  55.  
  56.         void DoTheMagic()
  57.         {
  58.             var go = Fsm.GetOwnerDefaultTarget(gameObject);
  59.             if (go == null)
  60.             {
  61.                 return;
  62.             }
  63.            
  64.             reloadID.Value = theScript.GetReloadID();            
  65.         }
  66.  
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment