public override bool AddCondition(Condition condition) { if (condition is TriPyramidBottomCondition) { TriPyramidBottomCondition addCondition = (TriPyramidBottomCondition)condition; bool result = CheckAddCondition(addCondition); // if (!result) // { // Debug.LogWarning("Error In Try"); // return false; // } bottomConditions.Add(addCondition); bottomConditions.Sort(ConditionComparer); // result = ResolveBottom(); // if (!result) // { // bottomConditions.Remove(addCondition); // return false; // } return(result); } return(false); }
private bool CheckAddCondition(TriPyramidBottomCondition condition) { // if (bottomConditions.Count == 3) // return false; // // check conflictions // foreach (TriPyramidBottomCondition c in bottomConditions) // { // if (c is BottomLengthCondition && condition is BottomLengthCondition) // { // if (((BottomLengthCondition)c).edge == ((BottomLengthCondition)condition).edge) // return false; // } // else if (c is BottomAngleCondition && condition is BottomAngleCondition) // { // if (((BottomAngleCondition)c).corner == ((BottomAngleCondition)condition).corner) // return false; // } // } // // special // if (bottomConditions.Count == 2) // { // if (bottomConditions[0] is BottomAngleCondition && bottomConditions[1] is BottomAngleCondition && condition is BottomAngleCondition) // return false; // } return(true); }
private int ConditionComparer(TriPyramidBottomCondition c1, TriPyramidBottomCondition c2) { return(c1.order.CompareTo(c2.order)); }