private void Handler(string name) { if (string.Equals(name, Name, StringComparison.OrdinalIgnoreCase)) { Triggered?.Invoke(); } }
public override void Inside(Triggered o) { Ball b = o.GetComponent <Ball>(); if (b != null && b.Owner != null && b.Owner.Team != this.Owner) { if (b.Owner.Team.Player == null) { b.Game.OnTry(this); } else { foreach (Unit u in b.Owner.Team) { u.HideButton(); } if (!b.Owner.ButtonVisible) { b.Owner.ShowButton("A"); } } if (b.Owner.isInTryZone == false) { b.Owner.HideButton(); } } }
protected override async Task OnLoop() { if (!enabled) { return; } var ns = sql.SelectToList(ServiceTable, (SqlColumn)ServiceColumnTimestamp > last, SqlOrder.By(ServiceColumnTimestamp, Order.Descending)); if (ns.Count > 0) { last = ns[0][ServiceColumnTimestamp].GetDateTime(); var tags = new List <string>(); foreach (SqlRow row in ns) { var tag = row[ServiceColumnTag].GetString(); if (tag != null && !tags.Contains(tag)) { tags.Add(tag); } } foreach (var tag in tags) { Triggered?.Invoke(this, new SqlServiceTriggerEventArgs(tag)); } } }
/// <summary> /// fires some trigger /// changes the state if needed /// /// returns true if a valid transition is called /// /// </summary> /// <param name="trigger"></param> public bool Fire(TTrigger trigger) { object fromState = fsm.CurrentStateMap.state; if (!dict.ContainsKey(fromState)) { return(false); } Transition <TTrigger, TState> transition = dict[fromState].ProcessTrigger(trigger); if (transition == null) { return(false); } if (transition != null && BeforeTriggered != null) { BeforeTriggered.Invoke(transition); } fsm.ChangeState(transition.toState, transition.overrideSetting); if (Triggered != null) { Triggered.Invoke(transition); } return(true); }
public virtual void Inside(Triggered o, Trigger t) { if (t == this) { Inside(o); } }
private void Tick(object sender, EventArgs e) { isRunningTrigger = true; parseTimer.Stop(); Triggered?.Invoke(); isRunningTrigger = false; }
public PlusButton(int height) { Rectangle backgroundRect; Children.Add(backgroundRect = new Rectangle { Fill = Brushes.DimGray, StrokeThickness = 1, Height = height, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch }); backgroundRect.RadiusX = backgroundRect.RadiusY = height / 2.0; Children.Add(new Rectangle { Fill = Brushes.White, Width = height * 2 / 3.0, Height = height * 2 / 9.0, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, IsHitTestVisible = false }); Children.Add(new Rectangle { Fill = Brushes.White, Width = height * 2 / 9.0, Height = height * 2 / 3.0, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, IsHitTestVisible = false }); backgroundRect.MouseEnter += (s0, e0) => ((Rectangle)s0).Fill = Brushes.MediumAquamarine; backgroundRect.MouseLeave += (s0, e0) => ((Rectangle)s0).Fill = Brushes.DimGray; backgroundRect.MouseUp += (s1, e1) => Triggered?.Invoke(this, EventArgs.Empty); }
public MinusButton(int width, int height) { Rectangle backgroundRect; Children.Add(backgroundRect = new Rectangle { Fill = Brushes.DarkGray, Width = width, Height = height, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }); backgroundRect.RadiusX = backgroundRect.RadiusY = Math.Min(width, height) / 2.0; Children.Add(new Rectangle { Fill = Brushes.White, Width = Math.Min(width, height) * 2 / 3.0, Height = Math.Min(width, height) * 2 / 9.0, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, IsHitTestVisible = false }); backgroundRect.MouseEnter += (s0, e0) => ((Rectangle)s0).Fill = Brushes.IndianRed; backgroundRect.MouseLeave += (s0, e0) => ((Rectangle)s0).Fill = Brushes.DarkGray; backgroundRect.MouseUp += (s1, e1) => Triggered?.Invoke(this, EventArgs.Empty); }
// Update is called once per frame void Update() { if (SecondSound != null && FirstSound != null) { if (transition == Triggered.SecondSound) { if (SecondSound.volume < 1) { SecondSound.volume += Time.deltaTime * TransitionSpeed; FirstSound.volume -= Time.deltaTime * TransitionSpeed; } if (SecondSound.volume >= 1) { SecondSound.volume = 1; FirstSound.volume = 0; transition = Triggered.NotTriggered; } } else if (transition == Triggered.FirstSound) { if (FirstSound.volume < 1) { FirstSound.volume += Time.deltaTime * TransitionSpeed; SecondSound.volume -= Time.deltaTime * TransitionSpeed; } if (FirstSound.volume >= 1) { FirstSound.volume = 1; SecondSound.volume = 0; transition = Triggered.NotTriggered; } } } }
public static void AskSurvey() { Stats stats = new Stats(); stats.Start(); Data data = new Data(); Console.WriteLine("What is your name?"); data.Name = TryAnswer(); Console.WriteLine("What is your age?"); data.Age = int.Parse(TryAnswer()); Console.WriteLine("What is your birth month?"); data.Month = TryAnswer(); //if(Triggered != null) //{ // Triggered(); //} Triggered?.Invoke(); data.Display(); }
public virtual void Left(Triggered o, Trigger t) { if (t == this) { Left(o); } }
public override void Entered(Triggered t) { Ball ball = t.GetComponent<Ball>(); if (ball != null) { Game.instance.OnTouch(this); //Game.instance.Referee.OnTouch(this); //ball.inTouch = this; //if (ball.Game.state == Game.State.PLAYING) //{ //this.gameObject.SendMessageUpwards("OnTouch", this, SendMessageOptions.DontRequireReceiver); //} /* else if(ball.Game.state == Game.State.TRANSFORMATION) { TransformationManager tm = ball.Game.GetComponent<TransformationManager>(); if (tm) tm.OnLimit(); else Debug.LogWarning("Error : I dont find Transformation Manager in the Game"); } */ } }
public virtual void Entered(Triggered o, Trigger t) { if (t == this) { Entered(o); } }
private void Tick(object state) { var position = _gazePointProvider.CurrentPosition; if (position == null) { return; } var pNew = position.Value; var now = _clock.Time; if (_point == null) { _point = new Timestamped <Point>(now, pNew); return; } var pOld = _point.Value.Value; if (Math.Abs(pOld.X - pNew.X) + Math.Abs(pOld.Y - pNew.Y) > _cursorMovementTolerance) { _point = new Timestamped <Point>(now, pNew); if (_cancellable && _inTrial) { Cancelled?.Invoke(this, EventArgs.Empty); } return; } if (_inTrial || _clock.Unit.ToMilliseconds(Math.Abs(now - _point.Value.Timestamp)) < _dwellToSelectDelay) { return; } _point = new Timestamped <Point>(now, pNew); _inTrial = true; Triggered?.Invoke(this, EventArgs.Empty); }
public override void Left(Triggered t) { Ball b = t.GetComponent<Ball>(); if (b != null){ b.Game.OnConversion(this); } }
public void Update() { var currentWatchLocationValue = m_memoryDomains.MainMemory.PeekByte(m_memoryTrigger.TriggerAddress); if (currentWatchLocationValue != m_lastWatchLocationValue) { bool wereConditionsMet = true; foreach (var v in m_memoryTrigger.ExpectedMemoryValues) { if (m_memoryDomains.MainMemory.PeekByte(v.Item1) != v.Item2) { wereConditionsMet = false; break; } } if (wereConditionsMet) { lock (m_lock) { m_isTriggered = true; } Triggered?.Invoke(this, EventArgs.Empty); } m_lastWatchLocationValue = currentWatchLocationValue; } }
public override void Left(Triggered o) { //Debug.Log("Sortie de la zone "+this.name+" par "+o.name); Ball b = o.GetComponent <Ball>(); if (o.GetType() == typeof(Unit)) { Unit u = (Unit)o; u.isInTryZone = false; u.HideButton(); } if (b != null) { b.inZone = null; //Debug.Log("ball zone : "+b.inZone); foreach (Unit u in b.Team) { u.HideButton(); } foreach (Unit u in b.Team.opponent) { u.HideButton(); } } }
public override void Entered(Triggered o, Trigger t) { Unit other = o.GetComponent <Unit>(); if (other != null) { if (t.GetType() == typeof(NearUnit)) { if (other.Team != this.Team) { if (!NearUnits.Contains(other)) { NearUnits.Add(other); } } } if (t.GetType() == typeof(RangeUnit)) { if (other.Team != this.Team) { if (!RangeUnits.Contains(other)) { RangeUnits.Add(other); } } } } }
void OnTriggerExit2D(Collider2D _other) { if (!Flip) { if (Player.transform.position.x < gameObject.transform.position.x) { transition = Triggered.FirstSound; } else { transition = Triggered.SecondSound; } } else { if (Player.transform.position.x > gameObject.transform.position.x) { transition = Triggered.FirstSound; } else { transition = Triggered.SecondSound; } } }
/// <summary> /// fires some trigger /// changes the state if needed /// /// returns true if a valid transition is called /// /// </summary> /// <param name="trigger"></param> public bool Fire(TTrigger trigger) { try { object fromState = fsm.CurrentStateMap.state; Transition <TTrigger, TState> transition = dict[fromState].ProcessTrigger(trigger); if (transition != null && BeforeTriggered != null) { BeforeTriggered.Invoke(transition); } fsm.ChangeState(transition.toState, transition.overrideSetting); if (Triggered != null) { Triggered.Invoke(transition); } return(true); } catch { // does not find valid transition regarding this state return(false); } }
public override void Entered(Triggered t) { Ball ball = t.GetComponent <Ball>(); if (ball != null) { Game.instance.OnTouch(this); //Game.instance.Referee.OnTouch(this); //ball.inTouch = this; //if (ball.Game.state == Game.State.PLAYING) //{ //this.gameObject.SendMessageUpwards("OnTouch", this, SendMessageOptions.DontRequireReceiver); //} /* * else if(ball.Game.state == Game.State.TRANSFORMATION) * { * TransformationManager tm = ball.Game.GetComponent<TransformationManager>(); * if (tm) * tm.OnLimit(); * else * Debug.LogWarning("Error : I dont find Transformation Manager in the Game"); * } */ } }
public override void Entered(Triggered t) { Ball b = t.GetComponent<Ball>(); if (b != null) { game.OnBallOut(); } }
public void Update(float time) { if (time - startTime > _delay) { endTime = time; Triggered?.Invoke(this); } }
void ProcessMessage(ref MSG msg, ref bool handled) { if ((msg.message == (int)WindowsMessage.HOTKEY) && (msg.wParam.ToInt32() == Identifier)) { Triggered?.Invoke(); } }
public void Execute() { Triggered?.Invoke(this, new TriggeredEventArgs()); foreach (var action in _actions) { action(); } }
public void Update() { var detected = m_Sense.Invoke(); if (detected != null) { Triggered?.Invoke(detected); } }
public override void Entered(Triggered t) { Ball b = t.GetComponent <Ball>(); if (b != null) { game.OnBallOut(); } }
public override void Left(Triggered t) { Ball b = t.GetComponent <Ball>(); if (b != null) { b.Game.OnConversion(this); } }
public void Tick() { if (Count == 0) { Count = Threshold; Triggered?.Invoke(); } Count--; }
protected Task Invoke(TriggeredEventArgs e) { return(Task.Run(() => { if (EnableTrigger && EnableAllTriggers) { Triggered?.Invoke(this, e); } })); }
public void OnEvent(AddonEventKind evt) { foreach (var trigger in _eventTriggers) { if ((trigger.Option == EarTrumpetEventKind.Startup && evt == AddonEventKind.InitializeAddon) || (trigger.Option == EarTrumpetEventKind.Shutdown && evt == AddonEventKind.AppShuttingDown)) { Triggered?.Invoke(trigger); } } }
private void OnTimerTick(object sender, EventArgs e) { if ((DateTime.Now - _lastEventTime) < _delay) { return; } var eventArgs = new DelayEventTimerArgs(_data); Triggered?.Invoke(this, eventArgs); _timer.IsEnabled = eventArgs.RepeatEvent; }
private void OnStateChanged(bool old, bool @new) { if (_mode == Mode.Falling && !@new) { Triggered?.Invoke(); } else if (_mode == Mode.Rising && @new) { Triggered?.Invoke(); } }
void OnTriggerExit2D(Collider2D _other) { if (!Flip) { if (Player.transform.position.x < gameObject.transform.position.x) transition = Triggered.FirstSound; else transition = Triggered.SecondSound; } else { if (Player.transform.position.x > gameObject.transform.position.x) transition = Triggered.FirstSound; else transition = Triggered.SecondSound; } }
public override void Entered(Triggered o) { Debug.Log("Entrée dans la zone de "+o.name); Ball b = o.GetComponent<Ball>(); if(o.GetType() == typeof(Unit)){ Unit u = (Unit)o; u.isInTryZone = true; //u.ShowButton("A"); } if (b != null) { b.Owner.ShowButton("A"); b.inZone = this; } }
public override void Inside(Triggered o) { Ball b = o.GetComponent<Ball>(); if (b != null && b.Owner != null && b.Owner.Team != this.Owner){ if (b.Owner.Team.Player == null){ b.Game.OnTry(this); } else{ foreach(Unit u in b.Owner.Team) { u.HideButton(); } if(!b.Owner.ButtonVisible) { b.Owner.ShowButton("A"); } } if(b.Owner.isInTryZone == false){ b.Owner.HideButton(); } } }
public override void Left(Triggered o) { Debug.Log("Sortie de la zone "+this.name+" par "+o.name); Ball b = o.GetComponent<Ball>(); if(o.GetType() == typeof(Unit)){ Unit u = (Unit)o; u.isInTryZone = false; u.HideButton(); } if (b != null) { b.inZone = null; Debug.Log("ball zone : "+b.inZone); foreach(Unit u in b.Team) { u.HideButton(); } foreach(Unit u in b.Team.opponent) { u.HideButton(); } } }
public virtual void Inside(Triggered o, Trigger t) { if (o == this) Inside(t); }
public virtual void Left(Triggered o) { }
public override void Left(Triggered o, Trigger t) { if (t.GetType() == typeof(ScrumField)) { Unit u = o.GetComponent<Unit>(); if (u != null) { if (scrumFieldUnits.Contains(u)) scrumFieldUnits.Remove(u); } } }
public virtual void Left(Triggered o, Trigger t) { if (t == this) Left(o); }
public override void Entered(Triggered o, Trigger t) { if (t.GetType() == typeof(NearBall)) { Unit u = o.GetComponent<Unit>(); if (u != null) { u.sm.event_NearBall(); } } else if (t.GetType() == typeof(ScrumField)) { Unit u = o.GetComponent<Unit>(); if (u != null) { if (!scrumFieldUnits.Contains(u)) scrumFieldUnits.Add(u); } } }
public override void Left(Triggered o, Trigger t) { Unit other = o.GetComponent<Unit>(); if (other != null) { if (t.GetType() == typeof(NearUnit)) { if (NearUnits.Contains(other)) { NearUnits.Remove(other); } } if (t.GetType() == typeof(RangeUnit)) { if (RangeUnits.Contains(other)) { RangeUnits.Remove(other); } } } }
public virtual void Left(Triggered o, Trigger t) { if (o == this) Left(t); }
public override void Inside(Triggered o, Trigger t) { Unit other = o.GetComponent<Unit>(); if (other != null) { if (t.GetType() == typeof(NearUnit)) { if (other.Team != this.Team) this.sm.event_NearUnit(other);// } } }
public override void Entered(Triggered o, Trigger t) { Unit other = o.GetComponent<Unit>(); if (other != null) { if (t.GetType() == typeof(NearUnit)) { if (other.Team != this.Team) { if (!NearUnits.Contains(other)) { NearUnits.Add(other); } } } if (t.GetType() == typeof(RangeUnit)) { if (other.Team != this.Team) { if (!RangeUnits.Contains(other)) { RangeUnits.Add(other); } } } } }
public virtual void Entered(Triggered o) { }
public virtual void Inside(Triggered o) { }
public virtual void Entered(Triggered o, Trigger t) { if (o == this) Entered(t); }