Exemple #1
0
 public void RemoveVariable <T>(TypedVariable <T> variable)
 {
     Undo.RecordObject(this, "Remove variable");
     blackboard.RemoveVariable(variable);
     EditorUtility.SetDirty(this);
     OnBehaviorTreeAltered?.Invoke();
 }
Exemple #2
0
        public static TypedVariable <T> CopyData(TypedVariable <T> typedVariable)
        {
            TypedVariable <T> newVariable = new TypedVariable <T>(typedVariable.ID)
            {
                name  = typedVariable.name,
                value = typedVariable.value
            };

            return(newVariable);
        }
        public TypedVariable <Color> GetColor(int id)
        {
            TypedVariable <Color> colorVariable = variableOverrides.Colors.Find(x => x.id == id);

            if (colorVariable == null)
            {
                colorVariable = tree.blackboard.Colors.Find(x => x.id == id);
            }
            return(colorVariable);
        }
Exemple #4
0
        public void RemoveVariable <T>(TypedVariable <T> variable)
        {
            switch (variable)
            {
            case TypedVariable <bool> boolVar:
                bools.Remove(boolVar);
                break;

            case TypedVariable <int> intVar:
                ints.Remove(intVar);
                break;

            case TypedVariable <float> floatVar:
                floats.Remove(floatVar);
                break;

            case TypedVariable <string> stringVar:
                strings.Remove(stringVar);
                break;

            case TypedVariable <Color> ColorVar:
                Colors.Remove(ColorVar);
                break;

            case TypedVariable <Vector2> Vector2Var:
                Vector2s.Remove(Vector2Var);
                break;

            case TypedVariable <Vector3> Vector3Var:
                Vector3s.Remove(Vector3Var);
                break;

            case TypedVariable <Vector4> Vector4Var:
                Vector4s.Remove(Vector4Var);
                break;

            case TypedVariable <Vector2Int> Vector2IntVar:
                Vector2Ints.Remove(Vector2IntVar);
                break;

            case TypedVariable <Vector3Int> Vector3IntVar:
                Vector3Ints.Remove(Vector3IntVar);
                break;

            case TypedVariable <GameObject> GameObjectVar:
                GameObjects.Remove(GameObjectVar);
                break;

            default:
                return;
            }

            masterList.Remove(variable);
        }