Exemplo n.º 1
0
        /// <summary>
        /// Konstruktor klasy
        /// </summary>
        static GameEngine()
        {
            //Tworzy obiekt GameTimera
            GameTimer         = new GameTimer();
            ActionList        = new ActionList();
            GameTimer.OnTick += GameTimer_OnTick;
            Enabled           = false;

            // Określa wstępną częstotliwość zegara
            GameTimer.Interval = 1;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compile the rule.
        /// </summary>
        /// <param name="ruleNode">XML representation of the rule.</param>
        /// <param name="specCompiler">An <see cref="XmlSpecificationCompiler"/>.</param>
        /// <param name="actionCompiler">An <see cref="XmlActionCompiler{TActionContext}"/>.</param>
        public void Compile(XmlNode ruleNode, XmlSpecificationCompiler specCompiler, XmlActionCompiler <TActionContext> actionCompiler)
        {
            var conditionNode =
                CollectionUtils.SelectFirst(ruleNode.ChildNodes,
                                            (XmlNode child) => child.Name.Equals("condition"));

            if (conditionNode != null)
            {
                _conditions = specCompiler.Compile(conditionNode as XmlElement, true);
            }
            else if (!IsDefault)
            {
                throw new ApplicationException("No condition element defined for the rule.");
            }
            else
            {
                _conditions = new AndSpecification();
            }

            var actionNode =
                CollectionUtils.SelectFirst(ruleNode.ChildNodes,
                                            (XmlNode child) => child.Name.Equals("action"));

            if (actionNode != null)
            {
                _actions = actionCompiler.Compile(actionNode as XmlElement, true);
            }
            else if (!IsExempt)
            {
                throw new ApplicationException("No action element defined for the rule.");
            }
            else
            {
                _actions = new ActionList <TActionContext>(new List <IActionItem <TActionContext> >());
            }
        }
Exemplo n.º 3
0
 public void AddAction(IActionList action)
 {
     ActionList.Add(action);
 }