Ejemplo n.º 1
0
    void OnGUI()
    {
        using (new GUILayout.VerticalScope("Box"))
        {
            GUILayout.Label("Press space key to move sphere to random box position");


            GUILayout.Label("random weight 1: " + weight1.ToString());
            weight1 = GUILayout.HorizontalSlider(weight1, 0f, 1f);

            GUILayout.Label("random weight 2: " + weight2.ToString());
            weight2 = GUILayout.HorizontalSlider(weight2, 0f, 1f);

            GUILayout.Label("random weight 3: " + weight3.ToString());
            weight3 = GUILayout.HorizontalSlider(weight3, 0f, 1f);

            if (GUILayout.Button("assign weights"))
            {
                var _w1 = blackboard.GetVariableByName <FRFloat>("Weight1");
                var _w2 = blackboard.GetVariableByName <FRFloat>("Weight2");
                var _w3 = blackboard.GetVariableByName <FRFloat>("Weight3");

                _w1.Value = weight1;
                _w2.Value = weight2;
                _w3.Value = weight3;
            }
        }
    }
Ejemplo n.º 2
0
        void OnGUI()
        {
            GUILayout.Label("Eventboard:");

            // Call the event named OnEvent1 on the assigned Evenboard
            if (GUILayout.Button("call event"))
            {
                events.CallEventByName("OnEvent1");
            }

            GUILayout.Label("Blackboard:");

            // Get the int variable named "health" on the assigned Blackboard
            if (GUILayout.Button("Get variable"))
            {
                var _healthVariable = variables.GetVariableByName <FRInt>("health");

                Debug.Log(_healthVariable.Value);
            }

            // Modify the health variable. No need to assign variable back to blackboard
            // as we're using a reference.
            if (GUILayout.Button("Modify variable"))
            {
                var _healthVariable = variables.GetVariableByName <FRInt>("health");

                _healthVariable.Value--;

                Debug.Log(_healthVariable.Value);
            }

            using (new GUILayout.VerticalScope("Box"))
            {
                GUILayout.Label("FlowReactor component:");
                GUILayout.Label("Get:");
                if (GUILayout.Button("Get exposed variable"))
                {
                    var _stringVariable = flowReactor.GetExposedVariable <FRString>("DebugLog", "log");
                    Debug.Log("Exposed variable: " + _stringVariable.Value);
                }

                GUILayout.Label("Set:");
                newLogMessage = GUILayout.TextField(newLogMessage);

                if (GUILayout.Button("Set exposed variable"))
                {
                    var _stringVariable = flowReactor.GetExposedVariable <FRString>("DebugLog", "log");
                    _stringVariable.Value = newLogMessage;
                }

                if (GUILayout.Button("Execute Debug.Log node"))
                {
                    events.CallEventByName("OnEvent2");
                }
            }
        }