public SceneCommandInfo Load(XElement node, string basePath)
        {
            var info = new SceneConditionCommandInfo();

            info.ConditionExpression = node.RequireAttribute("condition").Value;

            var attr = node.Attribute("entity");
            if (attr != null)
            {
                info.ConditionEntity = attr.Value;
            }

            info.Commands = _commandReader.LoadCommands(node, basePath);

            return info;
        }
示例#2
0
        private void ConditionCommand(SceneConditionCommandInfo command)
        {
            var condition = EffectParser.ParseCondition(command.ConditionExpression);
            var entity = Entities.GetAll().FirstOrDefault(e => e.Name == command.ConditionEntity);

            if (condition(entity))
            {
                RunCommands(command.Commands);
            }
        }