public Trigger() { Name = ""; _event = null; _conditions = new TriggerConditions(); _actions = new TriggerActions(); }
public TriggerActions(TriggerActions other) { _actions = new List <TriggerAction>(); foreach (TriggerAction action in other._actions) { if (action == null) { _actions.Add(null); } else if (action is TriggerActionPart) { _actions.Add(new TriggerActionPart((TriggerActionPart)action)); } else if (action is TriggerActionFlight) { _actions.Add(new TriggerActionFlight((TriggerActionFlight)action)); } else if (action is TriggerActionMessage) { _actions.Add(new TriggerActionMessage((TriggerActionMessage)action)); } else if (action is TriggerActionTimer) { _actions.Add(new TriggerActionTimer((TriggerActionTimer)action)); } } }
public void Configure(Trigger triggerToConfigure) { if ((triggerToConfigure == null) || (triggerToConfigure == _triggerToConfigure)) { return; } _triggerToConfigure = triggerToConfigure; _actions = new TriggerActions(_triggerToConfigure.TriggerActions); SelectAction(-1); }
public void OnLoad(ConfigNode node, VesselTriggers triggerConfig) { bool dataFound = false; ConfigNode childNode = null; TriggerEventType eventType = (TriggerEventType)(-1); // Event dataFound = node.TryGetNode(KEY_EVENT, ref childNode); if (dataFound) { dataFound = childNode.TryGetEnum <TriggerEventType>("type", ref eventType, (TriggerEventType)(-1)); if (dataFound) { _event = new TriggerEvent(eventType, triggerConfig); if (_event != null) { ConfigNode.LoadObjectFromConfig(_event, childNode); } } } // Condition dataFound = node.TryGetNode(KEY_CONDITIONS, ref childNode); if (dataFound) { _conditions = new TriggerConditions(); ConfigNode.LoadObjectFromConfig(_conditions, childNode); _conditions.OnLoad(childNode, triggerConfig); } // Actions dataFound = node.TryGetNode(KEY_ACTIONS, ref childNode); if (dataFound) { _actions = new TriggerActions(); ConfigNode.LoadObjectFromConfig(_actions, childNode); _actions.OnLoad(childNode, triggerConfig); } }