示例#1
0
 public void AddRule(TileRule rule)
 {
     List<TileRule> r = new List<TileRule>();
     if (this.rules != null)
         r.AddRange(this.rules);
     r.Add(rule);
     this.rules = r.ToArray();
 }
示例#2
0
        public void AddRule(TileRule rule)
        {
            List <TileRule> r = new List <TileRule>();

            if (this.rules != null)
            {
                r.AddRange(this.rules);
            }
            r.Add(rule);
            this.rules = r.ToArray();
        }
 public TileRuleMultipleOnlyOne(bool useRandom, TileRule[] otherRules, TileRuleCondition condition)
     : base(condition)
 {
     this.otherRules = otherRules;
     this.useRandom = useRandom;
 }
示例#4
0
 public TileRuleMultiple(TileRule[] otherRules, TileRuleCondition condition)
     : base(condition)
 {
     this.otherRules = otherRules;
 }
示例#5
0
        private void ExecuteTileRule(TilePosition pos, Tile tile, TileRule rule)
        {
            world.stats.executedRules++;

            if (rule.CheckConditions(this, tile, pos))
                rule.Execute(this, tile, pos);
        }
示例#6
0
        private void ExecuteTileRules(TilePosition pos, Tile tile, TileRule[] rules)
        {
            world.stats.executedRules += rules.Length;

            foreach (TileRule rule in rules)
            {
                if (rule.CheckConditions(this, tile, pos))
                {
                    rule.Execute(this, tile, pos);

                    if (GetTileType(pos) != tile.tileType)
                        break;
                }
            }
        }