Darkhitori

vItemManager/DropAllItens

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