/// <summary>Called if is fired.</summary> /// <param name="triggerStateType">State of the trigger.</param> protected override void CalledOnFire(TriggerStateType triggerStateType) { if (this.onFire != null) { this.onFire(triggerStateType); } }
internal void Fire(TriggerStateType triggerStateType) { IsFired = true; TriggerStateType = triggerStateType; if (CheckConditionToFire()) { CalledOnFire(triggerStateType); OnFire?.Invoke(this); } IsFired = false; }
/// <summary>Fires the specified trigger state.</summary> /// <param name="triggerStateType">State of the trigger.</param> internal void Fire(TriggerStateType triggerStateType) { this.IsFired = true; this.TriggerStateType = triggerStateType; if (this.CheckConditionToFire()) { this.CalledOnFire(triggerStateType); if (this.OnFire != null) { this.OnFire(this); } } this.IsFired = false; }
/// <summary>Sets the entry.</summary> /// <typeparam name="T">The <see langword="Type"/> T.</typeparam> /// <param name="name">The name.</param> /// <param name="intel">The intel.</param> public void SetEntry <T>(string name, T intel) { lock (this.entryLock) { TriggerStateType triggerStateType = this.intelligence.ContainsKey(name) ? TriggerStateType.ValueChanged : TriggerStateType.ValueAdded; this.intelligence[name] = intel; if (this.triggers.ContainsKey(name)) { foreach (Trigger item in this.triggers[name].Where(item => item.IsFired == false)) { item.Fire(triggerStateType); } } } }
/// <summary>Called if is fired.</summary> /// <param name="triggerStateType">State of the trigger.</param> protected virtual void CalledOnFire(TriggerStateType triggerStateType) { }
protected override void CalledOnFire(TriggerStateType triggerStateType) { _onFire?.Invoke(triggerStateType); }