Advertisement
Pro_Unit

EmeraldAIState

Sep 16th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace EmeraldAI
  4. {
  5.     public class EmeraldAIState
  6.     {
  7.         private bool _enabled;
  8.         public bool Enabled => _enabled;
  9.         public event Action OnEnable;
  10.         public event Action OnDisable;
  11.         public void Enable ()
  12.         {
  13.             _enabled = true;
  14.             OnEnable?.Invoke ();
  15.         }
  16.         public void Disable ()
  17.         {
  18.             _enabled = false;
  19.             OnDisable?.Invoke ();
  20.         }
  21.         public static implicit operator bool (EmeraldAIState state)
  22.         {
  23.             return (state != null) && state.Enabled;
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement