Advertisement
Darkhitori

CF_disableAllZones

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