Пример #1
0
        //int selectedidx = 0;
        public override void NodeGUI()
        {
            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();

            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Control");

            Assembly ta = typeof(BT.BTComposite).Assembly;

            var ts =
                ta.GetTypes().Where(t =>
                                    t.BaseType != null && t.BaseType == typeof(BT.BTComposite)
                                    );

            Type[]   tst    = ts.ToArray();
            string[] tsname = new string[tst.Length];
            for (int i = 0; i < tst.Length; ++i)
            {
                tsname[i] = tst[i].FullName;
            }

            m_SelectIdx = RTEditorGUI.Popup(m_SelectIdx, tsname);

            for (int i = 0; i < tst[i].GetFields().Count(); ++i)
            {
                if (tst[i].GetFields()[i].GetType() == typeof(int))
                {
                    //        EditorGUILayout.IntField(tst[i].GetFields()[i].Name);
                }
            }
        }
Пример #2
0
        //int selidx = 0;
        public override void NodeGUI()
        {
            EditorGUILayout.LabelField("Condition");

            Type[] typs = typeof(BTDecorator).Assembly.GetTypes().Where(t =>
                                                                        t.BaseType != null && t.BaseType == typeof(BTDecorator)).ToArray();

            string[] typsstrs = new string[typs.Length];
            for (int i = 0; i < typsstrs.Length; ++i)
            {
                typsstrs[i] = typs[i].FullName;
            }

            m_SelectIdx = RTEditorGUI.Popup(m_SelectIdx, typsstrs);
        }
Пример #3
0
    public INoise Display()
    {
        changed         = outOfBandChange;
        outOfBandChange = false;
        string[] names = noiseFunctions.Select(n => n.Name).ToArray();
        RTEditorGUI.Popup(new GUIContent("Noise", "The noise type to use"), noiseTypeIndex, names, selected =>
        {
            noiseTypeIndex       = selected;
            Type selectedNoise   = noiseFunctions[selected];
            selectedNoiseType    = selectedNoise.ToString();
            ConstructorInfo ctor = selectedNoise.GetConstructors()[0];

            noiseParameters = defaultParams(ctor);
            noiseFunction   = (Noise)ctor.Invoke(noiseParameters);

            outOfBandChange = true;
        });

        GUILayout.BeginVertical();
        ConstructorInfo ctor2 = noiseFunctions[noiseTypeIndex].GetConstructors()[0];

        ParameterInfo[] pInfo = ctor2.GetParameters();
        for (int i = 0; i < pInfo.Length; i++)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(pInfo[i].Name);
            if (pInfo[i].ParameterType == typeof(int))
            {
                noiseParameters[i] = RTEditorGUI.IntField((int)noiseParameters[i]);
            }
            else if (pInfo[i].ParameterType == typeof(float))
            {
                noiseParameters[i] = RTEditorGUI.FloatField((float)noiseParameters[i]);
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        if (GUI.changed)
        {
            noiseFunction = (Noise)ctor2.Invoke(noiseParameters);
            changed       = true;
        }

        return(noiseFunction);
    }