// Check this link to see if the event matches the requirements. If the link does not specify // any event data the link fires whatever the value of the data. public void MatchEvent(MHObjectRef sourceRefRef, int ev, MHUnion evData, MHEngine engine) { Logging.Assert(RunningStatus); // Should now be true if we call this. if (RunningStatus && m_nEventType == ev && sourceRefRef.Equal(m_EventSource, engine)) { // Source and event type match. bool fMatch = false; switch (m_EventData.Type) { case MHUnion.U_None: fMatch = true; break; // No data specified - always matches. case MHUnion.U_Bool: evData.CheckType(MHUnion.U_Bool); fMatch = evData.Bool == m_EventData.Bool; break; case MHUnion.U_Int: evData.CheckType(MHUnion.U_Int); fMatch = evData.Int == m_EventData.Int; break; case MHUnion.U_String: evData.CheckType(MHUnion.U_String); fMatch = evData.String.Equal(m_EventData.String); break; default: Logging.Log(Logging.MHLogWarning, "Unmatched Event: " + m_EventData.Type); Logging.Assert(false); break; // Should only be the above types. } // Fire the link if (fMatch) { Logging.Log(Logging.MHLogLinks, "Link fired - " + m_ObjectIdentifier.Printable()); engine.AddActions(m_LinkEffect); } } }
public override void Deactivation(MHEngine engine) { if (!RunningStatus) { return; } // Run any close-down actions. engine.AddActions(m_CloseDown); engine.RunActions(); base.Deactivation(engine); }
public override void CallActionSlot(int n, MHEngine engine) { if (m_nTokenPosition == 0) { // No slot has the token. if (n > 0 && n <= m_NoTokenActionSlots.Size) { engine.AddActions(m_NoTokenActionSlots.GetAt(n - 1)); } } else { if (m_nTokenPosition > 0 && m_nTokenPosition <= m_TokenGrpItems.Size) { MHTokenGroupItem pGroup = m_TokenGrpItems.GetAt(m_nTokenPosition - 1); if (n > 0 && n <= pGroup.ActionSlots.Size) { engine.AddActions(pGroup.ActionSlots.GetAt(n - 1)); } } } }
public override void Activation(MHEngine engine) { if (RunningStatus) { return; } base.Activation(engine); if (m_fRestarting) // Set by Quit { engine.AddActions(m_OnRestart); engine.RunActions(); } engine.EventTriggered(this, EventIsRunning); }
public override void Activation(MHEngine engine) { if (RunningStatus) { return; } base.Activation(engine); // Run any start-up actions. engine.AddActions(m_StartUp); engine.RunActions(); // Activate the ingredients in order. for (int i = 0; i < m_Items.Size; i++) { MHIngredient pIngredient = m_Items.GetAt(i); if (pIngredient.InitiallyActive()) { pIngredient.Activation(engine); } } m_fRunning = true; // Record the time here. This is the basis for absolute times. m_StartTime = MHTimer.getCurrentTimeSpan(); // Don't generate IsRunning here - that's done by the sub-classes. }