SHARE
TWEET

BaseTimedEntity.cs

a guest Aug 6th, 2016 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2.  
  3. public class BaseTimedEntity : MonoBehaviour
  4. {
  5.     public bool isActivated;
  6.  
  7.     public virtual void OnEnable()
  8.     {
  9.         Messenger<bool>.AddListener(GAME_CONST.BCAST_DAYNIGHT_LIGHT_EVENT, OnDayNightEvent);
  10.     }
  11.  
  12.     public virtual void OnDiable()
  13.     {
  14.         Messenger<bool>.RemoveListener(GAME_CONST.BCAST_DAYNIGHT_LIGHT_EVENT, OnDayNightEvent);
  15.     }
  16.  
  17.     public virtual void OnDayNightEvent(bool isDay)
  18.     {
  19.         if(isDay)
  20.         {
  21.             isActivated = true;
  22.             enabled = true;
  23.         }
  24.         else
  25.         {
  26.             isActivated = false;
  27.             enabled = false;
  28.         }
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top