public Subscriber(string iD, Timer pub) { this.id = iD; // Subscribe to the event pub.RaiseCustomEvent += this.HandleCustomEvent; }
static void Main(string[] args) { Timer timer = new Timer(); TimerListener listener = new TimerListener(); listener.Subscribe(timer); timer.DoStuffEveryTTicks(190000); }
public void EventArgs() { var timer = new Timer() { Name = "MyTimer"}; timer.Starting += TimerOnStarting; timer.Start(); }
public void CustomEventArgs() { var timer = new Timer() { Name = "MyTimer" }; timer.Stopping += TimerOnStopping; timer.Stop(); }
// Use this for initialization void Awake () { Stage = transform.Find("Stage").gameObject; CombatUI = transform.Find("Combat UI").gameObject; CombatTimer = GetComponent<Timer>(); UIController = CombatUI.GetComponent<UIController>(); InitializeUnitGroups(); }
void Start () { CombatTimer = Controller.CombatTimer; // NOTE(jordan): this only works because CombatUI only has 1 child, and it's the MessagePanel UIMessagePanel = gameObject.transform.GetChild(0).gameObject; UITextContainer = UIMessagePanel.transform.GetChild(0).gameObject; UIText = UITextContainer.GetComponent<Text>(); EndScreenText = EndScreen.transform.Find("Text").GetComponent<Text>(); EndScreen.SetActive(false); // NOTE(jordan): perform UI changes when turn control swaps EventSystem.On<TurnOver>(() => { // NOTE(jordan): set ui message SetMessage(TurnOverMessage()); // NOTE(jordan): show message for 1 seconds (needs to be fewer than turnInterval) Show(3f); // NOTE(jordan): set player targeting reticle if playerTurn }); }
public void Subscribe(Timer t) { t.TimerExpired += new Timer.TimerEventHandler(OnEventMethod); }