using System.Collections; using System.Collections.Generic; using UnityEngine; using KairoEngine.Core; namespace KairoEngine.Grids { [System.Serializable] public class PlaceableObjectRuleGroup { public ConditionType condition; public List rules = new List(); public bool Evaluate(Grid grid, PlacedObjectType placedObjectType, int x, int y, PlacedObjectType.Dir dir) { List results = new List(); for (int i = 0; i < rules.Count; i++) { results.Add(rules[i].Evaluate(grid, placedObjectType, x, y, dir)); } if(condition == ConditionType.AND) { foreach (var value in results) { if(value == false) return false; } return true; } else { foreach (var value in results) { if(value == true) return true; } return false; } } } }