Beispiel #1
0
        // Set color of node
        public void SetColor(Graphs.Styles.Color newColor)
        {
            if (color == newColor)
            {
                return;
            }

            color = newColor;
            _serializedObject.Update();
            _serializedColor.intValue = (int)newColor;
            _serializedObject.ApplyModifiedProperties();
        }
    private void DrawNode(State node)
    {
        bool isTrigger = false;

        object[] attributes = node.GetType().GetCustomAttributes(true);
        foreach (object attribute in attributes)
        {
            if (attribute is TriggerAttribute)
            {
                isTrigger = true;
            }
        }
        UnityEditor.Graphs.Styles.Color color = node.isDefaultState ? UnityEditor.Graphs.Styles.Color.Orange : node.GetType() == typeof(AnyState) ? UnityEditor.Graphs.Styles.Color.Aqua : UnityEditor.Graphs.Styles.Color.Gray;
        if (isTrigger)
        {
            color = UnityEditor.Graphs.Styles.Color.Green;
        }

        GUI.Box(node.position, node.name, UnityEditor.Graphs.Styles.GetNodeStyle("node", color, node == selectedState));
        DebugState(node);
        HandleNodeEvents(node);
    }