Pro_Unit

ConditionComponent

Apr 5th, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Events;
  3.  
  4. namespace GameCore
  5. {
  6.     public class ConditionComponent : MonoBehaviour
  7.     {
  8.         [SerializeField] ACondition condition;
  9.         [SerializeField] UnityEvent onTrue;
  10.         [SerializeField] UnityEvent onFalse;
  11.         public void DoCondition ()
  12.         {
  13.             if (condition.Value)
  14.             {
  15.                 onTrue.Invoke ();
  16.             }
  17.             else
  18.             {
  19.                 onFalse.Invoke ();
  20.             }
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment