Esempio n. 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();
 }
Esempio n. 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;
 }
Esempio n. 4
0
 public TileRuleMultiple(TileRule[] otherRules, TileRuleCondition condition)
     : base(condition)
 {
     this.otherRules = otherRules;
 }
Esempio n. 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);
        }
Esempio n. 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;
                }
            }
        }