Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            if (target)
            {
                var contentColor = GUI.contentColor;
                GUI.contentColor = Color.white;
                serializedObject.Update();
                if (!decision)
                {
                    decision = target as vStateDecision;
                }
                if (decision)
                {
                    if (skin == null)
                    {
                        skin = (GUISkin)Resources.Load("GUISkins/EditorSkins/NodeEditorSkin");
                    }

                    GUILayout.BeginVertical(skin.box);
                    if (target)
                    {
                        Draw();
                    }
                    GUILayout.EndVertical();
                }
                serializedObject.ApplyModifiedProperties();
                GUI.contentColor = contentColor;
            }
        }
Exemplo n.º 2
0
 public vStateTransition(vStateDecision decision)
 {
     if (decision)
     {
         decisions.Add(new vStateDecisionObject(decision));
     }
 }
Exemplo n.º 3
0
        string GetStatesUsingDecision(vStateDecision decision)
        {
            if (!decision)
            {
                return(string.Empty);
            }
            var states = currentFSM.states.FindAll(state => state != null && state.transitions != null && state.transitions.Exists(t => t != null && t.decisions != null && t.decisions.Exists(d => d != null && d.decision.Equals(decision))));

            if (states == null || states.Count == 0)
            {
                return(string.Empty);
            }
            StringBuilder text = new StringBuilder();

            text.Append(decision.Name + " is being used in " + states.Count + " state(s)\n");
            for (int i = 0; i < states.Count; i++)
            {
                text.Append(states[i].Name);
                if (i < states.Count - 1)
                {
                    text.Append(" , ");
                }
            }

            return(text.ToString());
        }
Exemplo n.º 4
0
 public vStateDecisionObject(vStateDecision decision)
 {
     this.decision = decision;
 }