/// <summary> /// Implementation and operations to remove concept from the class instance attached to this inspector /// </summary> private void RemoveConceptFromTargetList() { if (_selectedConcept >= target.ConceptList.Count || _selectedConcept < 0) { throw new System.Exception("@Fuzzy Editor Exception - Index out of range"); } _conditionDisplayer.RemoveConceptName(_conditionDisplayer.GetConceptByIndex(_selectedConcept)); if (target.ConditionList.Count <= 1) { //Clears the conditions because there is no available concepts target.RemoveCondition(); _conditionDisplayer.RemoveCondition(); //Removes the concept target.ConceptList.RemoveAt(_selectedConcept); } else { //Resets expressions with using the selected concept _conditionDisplayer.ResetExpressionsUsingConcept(_selectedConcept); //Removes the concept target.ConceptList.RemoveAt(_selectedConcept); } _selectedConcept = -1; }
private void AddRemoveExpressionFunctionality(int cndIndx) { if (GUILayout.Button("+", GUILayout.Width(50))) { int __funcIndex = 0; int __concIndex = 0; Operator __selectedOperator = Operator.END; //Adds the condition expression to the current condition ConditionExpression exp = new ConditionExpression( displayer.GetConceptByIndex(__concIndex), displayer.GetFunctionFromConceptByIndex(displayer.CurrentConcept, __funcIndex), __selectedOperator); target.ConditionList[cndIndx].AddExpression(exp); //if(target.Config != null) target.Config.ConditionList[cndIndx].AddExpression(exp); //Adds the current concept and function INDEX to the SELECTED concept and function list displayer.AddConceptInCurrentConditionExpressionList(cndIndx, __concIndex); displayer.AddFunctionInCurrentConditionExpressionList(cndIndx, __funcIndex); displayer.AddOperatorInCurrentConditionExpressionList(cndIndx, __selectedOperator); EditorUtility.SetDirty(target); } else if (GUILayout.Button("-", GUILayout.Width(50))) { if (target.ConditionList[cndIndx].ExpressionList.Count > 0) { displayer.RemoveConditionExpression(cndIndx); target.ConditionList[cndIndx].RemoveExpression(); EditorUtility.SetDirty(target); } else { Debug.LogWarning("@FuzzyBehaviourEditor - Cannot delete inicial condition expression. Delete condition instead"); } } }