Esempio n. 1
0
        bool EventTargetSetupGUI(ref PlayMakerCurvyComponentProxy.FsmEventSetup fsmEventSetup)
        {
            fsmEventSetup.target = (PlayMakerCurvyComponentProxy.PlayMakerProxyEventTarget)EditorGUILayout.EnumPopup("Target", fsmEventSetup.target);

            if (fsmEventSetup.target == PlayMakerCurvyComponentProxy.PlayMakerProxyEventTarget.FsmComponent)
            {
                fsmEventSetup.fsmComponent = (PlayMakerFSM)EditorGUILayout.ObjectField(fsmEventSetup.fsmComponent, typeof(PlayMakerFSM), true);

                return(fsmEventSetup.fsmComponent != null);
            }
            else if (fsmEventSetup.target == PlayMakerCurvyComponentProxy.PlayMakerProxyEventTarget.GameObject)
            {
                fsmEventSetup.gameObject = (GameObject)EditorGUILayout.ObjectField(fsmEventSetup.gameObject, typeof(GameObject), true);

                return(fsmEventSetup.gameObject != null);
            }
            else if (fsmEventSetup.target == PlayMakerCurvyComponentProxy.PlayMakerProxyEventTarget.Owner)
            {
                return(true);
            }
            else if (fsmEventSetup.target == PlayMakerCurvyComponentProxy.PlayMakerProxyEventTarget.BroadCastAll)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        void EventTargetGUI(ref PlayMakerCurvyComponentProxy.FsmEventSetup fsmEventSetup, string title)
        {
            EditorGUILayout.LabelField(title, EditorStyles.boldLabel);
            EditorGUI.indentLevel++;
            bool isTargetSetup = EventTargetSetupGUI(ref fsmEventSetup);

            if (!isTargetSetup)
            {
                ErrorFeedbackGui("No target defined");
                return;
            }
            bool isimplemented = _target.DoesTargetImplementsEvent(fsmEventSetup);

            GUILayout.BeginHorizontal();
            if (!fsmEventSetup.IsCustomEvent)
            {
                EditorGUILayout.LabelField("Event (built in)", fsmEventSetup.builtInEventName, "WordWrapLabel");

                if (GUILayout.Button("Edit", GUILayout.Width(40), GUILayout.Height(15)))
                {
                    fsmEventSetup.customEventName = fsmEventSetup.builtInEventName;
                }
            }
            else
            {
                fsmEventSetup.customEventName = EditorGUILayout.TextField("Event (Custom)", fsmEventSetup.customEventName, GUILayout.ExpandWidth(true));
                if (GUILayout.Button("X", GUILayout.Width(21), GUILayout.Height(15)))
                {
                    fsmEventSetup.customEventName = "";
                }
            }
            GUILayout.EndHorizontal();
            if (!isimplemented)
            {
                if (fsmEventSetup.target == PlayMakerCurvyComponentProxy.PlayMakerProxyEventTarget.BroadCastAll)
                {
                    ErrorFeedbackGui("There is no such global Event");
                }
                else
                {
                    ErrorFeedbackGui("This Event is not implemented on target");
                }
            }
            fsmEventSetup.debug = EditorGUILayout.Toggle("Debug", fsmEventSetup.debug);
            EditorGUI.indentLevel--;
        }