public void Broadcast(RSTriggerId inTriggerId, object inArgument, bool inbForce) { if (m_Destroyed) { return; } Broadcast(inTriggerId, RSInterop.ToRSValue(inArgument), inbForce); }
public void Trigger(IRSRuntimeEntity inEntity, RSTriggerId inTriggerId, object inArgument, bool inbForce) { if (m_Destroyed) { return; } TriggerRS(inEntity, inTriggerId, RSInterop.ToRSValue(inArgument), inbForce); }
internal void EvaluateTrigger(RSTriggerId inTriggerId, ExecutionScope inScope) { if (!m_Entity.IsAlive()) { return; } if (OnTrigger != null) { object arg = RSInterop.ToObject(inScope.Argument, inScope); OnTrigger.Invoke(inTriggerId, arg); } RSRuleData[] rules = m_Table?.Rules; int ruleCount; if (rules == null || (ruleCount = rules.Length) <= 0) { return; } using (PooledSet <string> triggeredGroups = PooledSet <string> .Alloc()) { for (int i = 0; i < ruleCount; ++i) { RSRuleData rule = rules[i]; if (rule.TriggerId != inTriggerId) { continue; } if (m_States[i].HasFlag(RuleState.Disabled)) { continue; } if (rule.DontInterrupt && m_Routines[i]) { continue; } if (!inScope.EvaluateConditions(rule.Conditions, rule.ConditionSubset)) { continue; } if (!string.IsNullOrEmpty(rule.RoutineGroup)) { if (!triggeredGroups.Add(rule.RoutineGroup)) { continue; } StopRuleGroup(rule.RoutineGroup); } if (rule.OnlyOnce) { m_States[i] |= RuleState.Disabled; } if (rule.Actions != null) { ExecutionScope scope = inScope; scope.m_Environment.CloneScopeIfNecessary(scope, rule.Flags, out scope); m_Routines[i].Replace(m_Entity.ProxyObject, scope.PerformActions(rule.Actions)) .ExecuteWhileDisabled().SetPhase(m_Entity.ExecutionPhase) .TryManuallyUpdate(0); } } } }
object IScriptContext.PeekRegister(RegisterIndex inRegister) { return(RSInterop.ToObject(PeekRegister(inRegister), this)); }
void IScriptContext.LoadRegister(RegisterIndex inRegister, object inValue) { LoadRegister(inRegister, RSInterop.ToRSValue(inValue)); }
void IScriptContext.Broadcast(RSTriggerId inTriggerId, object inArgument, bool inbForce) { m_Environment.Broadcast(inTriggerId, RSInterop.ToRSValue(inArgument), inbForce); }
void IScriptContext.Trigger(IRSRuntimeEntity inEntity, RSTriggerId inTriggerId, object inArgument, bool inbForce) { m_Environment.Trigger(inEntity, inTriggerId, RSInterop.ToRSValue(inArgument), inbForce); }