public ProceduralObjectConfiguration(ProceduralObjectConfiguration _config)
            {
                go     = _config.go;
                active = _config.active;
                placeOnOccupiedCell = _config.placeOnOccupiedCell;
                useTileRotation     = _config.useTileRotation;
                offsetRotation      = _config.offsetRotation;
                offsetPosition      = _config.offsetPosition;
                selectedLayer       = _config.selectedLayer;

                // If current object is a child, use child spawn properties
                radius     = _config.radius;
                spawnCount = _config.spawnCount;
                // random rotation
                useRandomRotation = _config.useRandomRotation;
                randomRotationMin = _config.randomRotationMin;
                randomRotationMax = _config.randomRotationMax;
                // random scaling
                useRandomScaling = _config.useRandomScaling;
                uniformScaling   = _config.uniformScaling;
                randomScalingMax = _config.randomScalingMax;
                randomScalingMin = _config.randomScalingMin;

                ruleType   = _config.ruleType;
                weight     = _config.weight;
                blockType  = _config.blockType;
                tileTypes  = _config.tileTypes;
                everyNTile = _config.everyNTile;
                inset      = _config.inset;
            }
Ejemplo n.º 2
0
 /// <summary>
 /// The Protected Constructor Of The Abstract Rule Class
 /// </summary>
 /// <param name="name">The Name Of The Rule</param>
 /// <param name="pattern">The Pattern To Be Used By The Rule</param>
 /// <param name="type">The Type Of The Rule according to the Enum</param>
 /// <param name="action">The Type Of The Actions according to the Enum</param>
 protected Rule(string name, string pattern, RuleTypes type, ActionTypes action)
 {
     this.name         = name;
     this.pattern      = pattern;
     this.type         = (int)type;
     this.action       = (int)action;
     NormalizationList = new Hashtable();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// The Protected Constructor Of The Abstract Rule Class
 /// </summary>
 /// <param name="name">The Name Of The Rule</param>
 /// <param name="pattern">The Pattern To Be Used By The Rule</param>
 /// <param name="type">The Type Of The Rule according to the Enum</param>
 /// <param name="action">The Type Of The Actions according to the Enum</param>
 protected Rule(string name, string pattern, RuleTypes type, ActionTypes action)
 {
     this.name = name;
     this.pattern = pattern;
     this.type = (int) type;
     this.action = (int) action;
     NormalizationList = new Hashtable();
 }
Ejemplo n.º 4
0
 public Rule(Map parent, int pos, RuleTypes type, RuleDirections dir, string pattern, string replacement)
     : this(parent, pos)
 {
     this.Type = type;
     this.Direction = dir;
     this.Pattern = pattern;
     this.Replacement = replacement;
 }
Ejemplo n.º 5
0
 public Rule AddRule(RuleTypes type, RuleDirections dir, string pattern, string replacement)
 {
     Rule r = new Rule(this, this.NextRulePos, type, dir, pattern, replacement);
     rules.Add(this.NextRulePos, r);
     this.NextRulePos ++;
     return r;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Process the selected rules on the current working memory and stops
        /// infering when no new Fact is deducted or retracted.
        /// </summary>
        /// <remarks>
        /// If businessObjects is Null, this method performs the same operation as <code>Process()</code>
        ///  ; else it uses the binder provided in the constructor to perform fact operations and
        /// orchestrate the process.
        /// If businessObjects is not Null and no binder has been provided in the constructor, it throws
        /// a BREException.
        /// </remarks>
        /// <param name="businessObjects">An IDictionary of business objects, or Null.</param>
        /// <param name="ruleType">The particular rule type to process.</param>
        public void Process(IDictionary businessObjects, RuleTypes ruleType)
        {
            CheckInitialized();
            if (Logger.IsInferenceEngineInformation) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Information, 0, "NxBRE v" + Reflection.NXBRE_VERSION + " Inference Engine Processing Started");
            if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Processing: " + (businessObjects==null?"null":businessObjects.Count.ToString()) + " business objects and rules of type: " + ruleType);

            if ((ruleType == RuleTypes.PerformativesOnly) || (ruleType == RuleTypes.All)) ProcessPerfomatives();
            if ((ruleType == RuleTypes.ConnectivesOnly) || (ruleType == RuleTypes.All)) ProcessConnectives(businessObjects);

            if (Logger.IsInferenceEngineInformation) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Information, 0, "NxBRE Inference Engine Processing Finished");
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Process the selected rules on the current working memory and stops
 /// infering when no new Fact is deducted or retracted.
 /// </summary>
 /// <param name="ruleType">The particular rule type to process.</param>
 public void Process(RuleTypes ruleType)
 {
     Process(null, ruleType);
 }
Ejemplo n.º 8
0
 internal bool RuleEnabled(RuleTypes cellTypeQuery)
 {
     return ((this.Configuration.Rules & cellTypeQuery) == cellTypeQuery) || ((this.Configuration.Rules & RuleTypes.All) == RuleTypes.All);
 }
Ejemplo n.º 9
0
 /*
  * public int RuleAction
  * {
  *      return action;
  * }
  */
 public string RuleTypeString()
 {
     return(RuleTypes.GetName(typeof(RuleTypes), this.type));
 }
Ejemplo n.º 10
0
    void  OnGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Rule Editor", EditorStyles.boldLabel);
        if (rulesList != null)
        {
            if (GUILayout.Button("Show Rules List"))
            {
                EditorUtility.FocusProjectWindow();
                Selection.activeObject = rulesList;
            }
        }
        if (GUILayout.Button("Open Rule List"))
        {
            OpenItemList();
        }
        if (GUILayout.Button("New Rule List"))
        {
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = rulesList;
        }
        GUILayout.EndHorizontal();

        if (rulesList == null)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            if (GUILayout.Button("Create New Rule List", GUILayout.ExpandWidth(false)))
            {
                CreateNewItemList();
            }
            if (GUILayout.Button("Open Existing Rule List", GUILayout.ExpandWidth(false)))
            {
                OpenItemList();
            }
            GUILayout.EndHorizontal();
        }

        GUILayout.Space(20);

        if (rulesList != null)
        {
            GUILayout.BeginHorizontal();

            GUILayout.Space(10);
            string[] rtps = Enum.GetNames(typeof(RuleTypes));

            foreach (string rt in rtps)
            {
                RuleTypes wrt = (RuleTypes)Enum.Parse(typeof(RuleTypes), rt);
                if (wrt == viewIndex)
                {
                    EditorGUI.BeginDisabledGroup(true);
                }

                if (GUILayout.Button(Regex.Replace(rt, @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0"), GUILayout.ExpandWidth(true)))
                {
                    viewIndex = wrt;
                }
                if (wrt == viewIndex)
                {
                    EditorGUI.EndDisabledGroup();
                }
            }

            GUILayout.EndHorizontal();

            GUILayout.Space(25);

            switch (viewIndex)
            {
            case RuleTypes.InstancePrimitives:
                if (rulesList.instantiateRule != null)
                {
                    InstantiateRuleEditor.DrawCustomEditor((InstantiateRule)rulesList.instantiateRule);
                }
                else
                {
                    GUILayout.Label("This Rule Set is Empty.");
                }
                break;

            default:
                GUILayout.Label("Not yet implemented");
                break;
            }
        }

        if (GUI.changed && rulesList != null)
        {
            EditorUtility.SetDirty(rulesList);
        }
    }
Ejemplo n.º 11
0
 internal bool RuleEnabled(RuleTypes cellTypeQuery)
 {
     return(((this.Configuration.Rules & cellTypeQuery) == cellTypeQuery) || ((this.Configuration.Rules & RuleTypes.All) == RuleTypes.All));
 }