using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; using KairoEngine.Chunks; namespace KairoEngine.VoxelBuildingSystem { [System.Serializable] public class VoxelBuildingRuleset { public ConditionType condition; public List rules = new List(); public bool Evaluate(VoxelBuildingSystem buildingSystem, int templateIndex, Vector3Int position, int rotationIndex) { List results = new List(); for (int i = 0; i < rules.Count; i++) { results.Add(rules[i].Evaluate(buildingSystem, templateIndex, position, rotationIndex)); } 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; } } } public enum ConditionType { AND, OR } }