WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
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.Limit(0,int.MaxValue); }
29  }
30 
31 
38  {
39  if (TargetEffect != null)
40  {
41  if (DelayMs > 0)
42  {
43  Table.Pinball.Alarms.RegisterAlarm(DelayMs, AfterDelay, TableElementData, true);
44  }
45  else
46  {
47  TriggerTargetEffect(TableElementData);
48  }
49  }
50  }
51 
52  private void AfterDelay(object Data)
53  {
54  TriggerTargetEffect((TableElementData)Data);
55  }
56 
57 
58 
63  public override void Init(Table.Table Table)
64  {
65 
66  base.Init(Table);
67  }
68 
72  public new void Finish()
73  {
74  try
75  {
76  Table.Pinball.Alarms.UnregisterAlarm(AfterDelay);
77 
78  }
79  catch { }
80  base.Finish();
81  }
82 
83  }
84 }
Pinball Pinball
Gets the pinball object to which the Table object belongs.
Definition: Table.cs:36
AlarmHandler Alarms
Gets the AlarmHandler object for the Pinball object.
Definition: Pinball.cs:71
override void Trigger(TableElementData TableElementData)
Triggers the effect. If the TargetEffect throws a exception, it will be deactivated.
Definition: DelayEffect.cs:37
override void Init(Table.Table Table)
Initializes the DelayEffect.
Definition: DelayEffect.cs:63
Data representing the state of a table emlement
new void Finish()
Finishes the DelayEffect.
Definition: DelayEffect.cs:72
Base class for effects targeting another effect.
The Table namespace contains all table specific classes like the Table class itself, TableElement and effect assigment classes.
Definition: Table.cs:14
Holds all table specific information and handles all TableElements
Definition: Table.cs:20
Table()
Initializes a new instance of the Table class.
Definition: Table.cs:388
The effect fires a assigned target effect after a specified delay. The original values supplied when...
Definition: DelayEffect.cs:14