DirectOutputR1
DirectOutput framework R1 for virtual pinball cabinets.
Go to:
Overview 
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros Pages
DelayEffect.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using DirectOutput.Table;
6 
7 namespace DirectOutput.FX.TimmedFX
8 {
15  {
16 
17  private int _DelayMs = 0;
18 
25  public int DelayMs
26  {
27  get { return _DelayMs; }
28  set { _DelayMs = value; }
29  }
30 
31 
37  public override void Trigger(TableElementData TableElementData)
38  {
39  if (TargetEffect != null)
40  {
41  Table.Pinball.Alarms.RegisterAlarm(DelayMs, TriggerTargetEffect, TableElementData, true);
42  }
43  }
44 
45 
46  private void TriggerTargetEffect(object AlarmParameter)
47  {
48  if (TargetEffect != null)
49  {
50  try
51  {
52  TargetEffect.Trigger((TableElementData)AlarmParameter);
53  }
54  catch (Exception E)
55  {
56  Log.Exception("The target effect {0} of the DelayEffect {1} has trown a exception.".Build(TargetEffectName, Name), E);
57  TargetEffect = null;
58  }
59  }
60  }
61 
62 
67  public override void Init(Table.Table Table)
68  {
69 
70  base.Init(Table);
71  }
72 
76  public new void Finish()
77  {
78  try
79  {
80  Table.Pinball.Alarms.UnregisterAlarm(TriggerTargetEffect);
81 
82  }
83  catch { }
84  base.Finish();
85  }
86 
87  }
88 }